View Full Version : Apple Script Auto Login

Nov 9, 2009, 12:13 PM
Hey all my school makes me log into the server through an online form. Every time my computer goes to sleep or is turned on I have to relogin. It is really annoying and I want to have a way for my computer to autologin when my computer wakes up or is just turned on... here is what I have and it works I just need to figure out how to get it to run when the computer wakes up... no problem getting it to work when I turn on the computer... Any ideas... I would also like to try to make it so it works in the background with out me seeing the screen pop up every time is there a way to do this. Thanks for any help you may offer. here is the script

set mainURL to "http://zzzzz.com" as text
set mainLogin to "XXXXXXX" as text
set mainPword to "Y6y66y" as text
--display dialog mainURL

tell application "Safari"
set thisDocument to make new document at end of documents

do JavaScript "window.open('" & mainURL & "')" in thisDocument

tell application "System Events"
tell application process "Safari"
delay 5
-- keystroke (ASCII character 9) -- tab character

keystroke mainLogin
--delay 1
keystroke (ASCII character 9) -- tab character
--delay 1
keystroke mainPword
keystroke (ASCII character 13) -- this equals return

end tell
end tell

end tell