Here is my current applescript. What I do is to use ssh to login to my remote system. Then, I run the following script from the command line. My remote system is running 10.4.11.
log " --- Starting on " & ((current date) as string) & " --- "
-- play sound seems to let a process hang around
try
set theLoc to ((path to system folder) as string) & "Library:Sounds:"
-- Play Sound
-- http://microcosmsoftware.com/playsound/
tell application "Play Sound"
play theLoc & "Basso.aiff" repeat 4
end tell
end try
-- Go after screen resolution
do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 'Resolution'" -- get info
tell the result to set {DisplayWidth, DisplayHeight} to {word 2, word 4} -- get resolution
repeat with i from 1 to 20
if DisplayWidth = 800 then
(move mouse {474 + (i * 5), 14})
else
-- one icon size is about... 30 horizonal. bigger number is to the right
(move mouse {726 + (i * 10), 11})
end if
click mouse
delay 2
tell application "System Events"
repeat 6 times
key code 125 -- cursor down key code 125
delay 1
end repeat
delay 2
keystroke return
delay 3
-- command a to hilight input field
repeat 12 times
--key code 97 -- a
--delay 1
end repeat
keystroke "192.168.0.100:5900"
-- if you went to press return after typing the password
delay 3
keystroke return
-- incase we get an error message. should probably be ok, in good case.
delay 3
keystroke return
end tell
delay 3
--tell "System Events" to set frontmost of process "My Application" to true
set currentApp to path to frontmost application
set myPath to (path to me) as alias
log "currentApp & myPath"
log currentApp
log myPath
activate myPath
set theResult to display dialog "Remote session running?" buttons {"Yes", "No"} default button "Yes" giving up after 7
log theResult
if button returned of theResult is "Yes" then exit repeat
end repeat
(*
First, there is the XTools scripting addition, which will give AppleScript the ability to move the mouse.
http://www.lestang.org/osax/XTool/
XTool-2.0.dmg.tgz
Installation :
Drag XTool.osax from insite the image to one of the following locations (create the directory if it does not exist) :
a : ~/Library/ScriptingAdditions/
b : /Library/ScriptingAdditions/
c : /System/Library/ScriptingAdditions/
I have it in directory /System/Library/ScriptingAdditions/
My other two directories do not exit: ~/Library/ScriptingAdditions/ &
/Library/ScriptingAdditions/
. Next, you will need to place a script application into your login items (System Preferences > Accounts > Login Items) that will move the mouse when you log in:
*)