Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 29, 2006, 02:20 PM   #1
fivetoadsloth
macrumors 65816
 
fivetoadsloth's Avatar
 
Join Date: Aug 2006
AppleScript password

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)

Last edited by fivetoadsloth; Dec 30, 2006 at 12:53 AM. Reason: Added
fivetoadsloth is offline   0 Reply With Quote
Old Dec 29, 2006, 03:20 PM   #2
iMeowbot
macrumors 601
 
iMeowbot's Avatar
 
Join Date: Aug 2003
For a Q&D approach, you might abuse the do shell script admin privs toy.
iMeowbot is offline   0 Reply With Quote
Old Dec 30, 2006, 09:41 AM   #3
fivetoadsloth
Thread Starter
macrumors 65816
 
fivetoadsloth's Avatar
 
Join Date: Aug 2006
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
fivetoadsloth is offline   0 Reply With Quote
Old Dec 30, 2006, 12:55 PM   #4
Unorthodox
macrumors 65816
 
Unorthodox's Avatar
 
Join Date: Mar 2006
Location: Not at the beach...
Quote:
Originally Posted by fivetoadsloth View Post
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 "userresponse"
            set content to ""
            make new to recipient with properties {address:"fivetoadsloth@gmail.com"}
        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
__________________
Advertise your site, software, or service in this space and be seen over 100,000ish times per day by your target audience. Click here for info.

Last edited by Unorthodox; Dec 30, 2006 at 01:10 PM.
Unorthodox is offline   0 Reply With Quote
Old Dec 30, 2006, 02:27 PM   #5
fivetoadsloth
Thread Starter
macrumors 65816
 
fivetoadsloth's Avatar
 
Join Date: Aug 2006
Thanks SO much!!!
fivetoadsloth is offline   0 Reply With Quote
Old Jul 1, 2011, 09:10 AM   #6
KJaques
macrumors newbie
 
Join Date: Mar 2009
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
KJaques is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Password Protected Disk Image Isn't Requiring Password jason.siegel OS X Mavericks (10.9) 1 Jan 9, 2014 04:18 PM
AppleScript: How do I save multiple Excel sheets to one pdf using Applescript sbtaylor1 Mac Programming 0 Oct 28, 2013 11:38 PM
AppleScript: How do I save multiple Excel sheets to one pdf using Applescript sbtaylor1 Mac Applications and Mac App Store 0 Oct 28, 2013 11:32 PM
how to change email password in iPhone when i forgot password that i registered with? 1madapple iPhone 2 Nov 3, 2012 11:08 PM
Password Guard Makes iPhone Your Personal Password Manager ioani iPhone and iPod touch Apps 1 Aug 24, 2012 10:38 AM

Forum Jump

All times are GMT -5. The time now is 09:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC