Hi there,
I play on-line flash based games. Some tasks are very repetitive. Select soldier, give food, give water, make him rest etc.
I am trying to automate this using Applescript. The challenge is that the windows/menus are all custom generated under flash. So there is no DOM to manipulate/reference etc. The only way to do this is through programming the mouse to move and click.
I found a little application called extra suites that Applescript can call to get the co ordinates. This has worked great until, I upgraded to Snow Leopard and now I need Rosetta, which I dont want to load. Looking through these forums I found loads of discussions, but most were over 5 years old, so I’m guessing there is a easier way to do this in 2009
Here is my trust code from years gone past
set army_length to 5
set army_width to 5
set army_length to army_length - 1
set yarmy_width to army_width - 1
set myLoc to my getMouseLocation()
set start_x to item 1 of myLoc
set start_y to item 2 of myLoc
tell application "Extra Suites"
repeat with j from 0 to army_width
repeat with i from 0 to army_length
if (i > 0 or j > 0) then
set x to start_x + (25 * i) - (25 * j)
set y to start_y - (12 * i) - (12 * j)
ES move mouse {x, y}
delay 0.05
ES click mouse
delay 0.05
end if
end repeat
end repeat
ES move mouse {start_x, start_y}
end tell
on getMouseLocation()
tell application "Extra Suites"
set mouseLoc to (ES mouse location)
end tell
return mouseLoc
end getMouseLocation
return 0
Any help would be appreciated.
Thanks
Alan.
Model: MacBookPro 7"
AppleScript: 2.1.1
Browser: Firefox 3.5.5
Operating System: Mac OS X (10.6)