Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'sending password via applescript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
sending password via applescript
Authored by: FrederickFowles on Jan 15, '02 09:20:34PM
I have wrote an apple script to boot me back to 9 in the week mornings after a night of network rendering on X. The only problem is getting the do shell script to send the password after the sudo command, does anyone know how to do this or append it to the sudo command ? Here is the script so far
try repeat set the date_stamp to ((the current date) as string) set current_name to date_stamp set check_weekend to date_stamp set character_countPre to the number of characters of check_weekend as integer set character_count1 to character_countPre - 3 set the check_weekendNew to (characters 1 thru -(the character_count1 + 1) of the check_weekend) as string if check_weekendNew does not contain "Sat" then try if check_weekendNew does not contain "Sun" then try set character_count2 to the number of characters of current_name as integer set character_count3 to ((character_count2 - 11) as integer) set the new_name2 to (characters (the character_count3 + 1) thru -1 of the current_name) as string set new_Date_Stamp to ((new_name2) as string) if new_Date_Stamp = " 9:00:00 am" then try do shell script " sudo nvram boot-device='mac-io/ata-4@1f000/@0:10,:tbxi'" do shell script "sudo reboot" on error beep exit repeat end try end try end try end repeat end try


[ Reply to This | # ]
sending password via applescript
Authored by: ChaChi on Mar 03, '02 04:27:58PM

You can send your password in this format:

do shell script "Terminal commands here" password "Administrator password here" with administrator privileges

Be careful with this because your password gets stored in plain text within the AppleScript. Anyone who knows anything anout AppleScript could view your password. Better to use this:

do shell script "Terminal commands here" with administrator privileges

This will ask the person who runs the script for a password.

Hope this helps...



[ Reply to This | # ]
sending password via applescript
Authored by: RickoKid on Oct 28, '02 09:01:01PM

I came up with this (considerably simpler) script to boot back to OS 9:

display dialog "Are you sure you want to restart in MacOS 9?"
do shell script "sudo /usr/sbin/bless -folder9 '/Volumes/OS 9/System Folder' -setOF"
ignoring application responses
tell application "Finder" to restart
end ignoring

Just change the path to your OS 9 disk (mine is on a different disk called "OS 9", if yours is on the same partition it will be '/System Folder'.

If it doesn't work try removing the 'ignoring application' parts (probably won't work on anything less than 10.2 without these).

Good Luck!



[ Reply to This | # ]
sending password via applescript
Authored by: john8675309 on Jun 16, '03 01:37:44PM

Don't know if I am way to late for this but I have written an entire program that does this in Java it can be found at

http://jkcool.com/xpost/



[ Reply to This | # ]