I leave my PowerBook G4 (running OS X 10.4.5) mainly unattended, and I want to be able to access it remotely; to do that, it has to be always online. From time to time, my Internet connection drops and I've come up with an AppleScript which reconnects to the Internet by performing all the necessary tasks. The script is launched automatically every half an hour by iCal (a crontab would be an excellent alternative ... maybe I'll try it later on).
The multi-step procedure to reconnect is the following:
set CR to ASCII character of 13
tell application "System Events"
tell application "Camino" to activate
delay 30
keystroke tab & tab & tab & [username] & tab & ¬
[password] & tab & "O" & tab & CR
delay 20
tell application "Camino" to quit
end tell
end
I am using Camino as browser. The Tab keys are used to navigate through the fields of the login homepage; [username] and [password] in the script are replaced by my real username and password. The O is the key to digit after selecting the field containing the list of providers. The script is my first attempt to use AppleScript. It works.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060403003036779