Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fivetoadsloth

macrumors 65816
Original poster
Aug 15, 2006
1,035
0
Is there a way in apple scipt to open the dialogue box asking for an admin password? Im writting a script that ill automoate to apper every wednesday asking for the trash to be aken out and when you hit ok the dialoge pops up asking for the password and an aadult would type in the pass and itll go back to normal. Thanks alot.
One more question

Code:
tell application "Mail"
	message
	subject "userresponse"
	content
	mailto "fivetoadsloth@gmail.com"
	
end tell

What is wrong with that? what the goal is is to send an email to myself with the userreponse in a dialog above. Thanks SO much.
my goal is to mkae the subject the user response and have no content. (Im expecting the user response to be fairly short, 6-7 characters)
 

fivetoadsloth

macrumors 65816
Original poster
Aug 15, 2006
1,035
0
Code:
tell application "Mail"
	message
	subject "userresponse"
	content
	mailto "fivetoadsloth@gmail.com"
	
end tell

What is wrong with that? it is supposed to send a user response to my email adressas the subject and have no message.
Thanks alot
 

Unorthodox

macrumors 65816
Mar 3, 2006
1,087
1
Not at the beach...
What is wrong with that? it is supposed to send a user response to my email adressas the subject and have no message.
Thanks alot
Pretty much everything.
Try this...
Code:
tell application "Mail" 
        activate
        set newMessage to make new outgoing message
        tell newMessage
            set subject to "[I][B]userresponse[/B][/I]"
            set content to ""
            make new to recipient with properties {address:"[I][B]fivetoadsloth@gmail.com[/B][/I]"}
        end tell
        send newMessage
end tell

And as for the password thingy. Is this what you want?
Code:
set the_password to "password" --set this to the password you want to use

set correct_pass to false
set the_dialog to "Please enter your password:"
repeat while correct_pass is false
	display dialog the_dialog default answer "" buttons {"Cancel", "OK"} default button 2 with icon 0 with hidden answer
	if the text returned of the result is the_password then
		tell application "Finder"
			set correct_pass to true
			empty the trash
		end tell
	else
		beep
		set the_dialog to "Incorrect password." & return & "Please enter your password:"
	end if
end repeat
 

KJaques

macrumors newbie
Mar 4, 2009
2
0
Hiding Typing

I searched this thread when I was looking for how to hide the typing when asking for a password. I took it to mean you can't. Later, I found you could, by using the parameters "default answer" and "hidden answer" with "display dialog", as follows:

display dialog "Enter Password" default answer "" with hidden answer
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.