Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

legalcheese

macrumors newbie
Original poster
Aug 19, 2009
2
0
Hey everypeoplez!

I'm trying to make a trainer in Applescript that will basically beat a game for you. So right now I'm working on the game Bloxorz, and have hit a snag. I am able to make the script automatically choose Start Game and then Skip Instructions, but it won't move the block even as I have it set to keystroke the arrow keys. Here's my code:

Code:
set game_choice to (choose from list {"Bloxorz"} with prompt "Welcome to the MiniClip trainer!  This application will help you to beat numerous games listed on the Minclip website.  Select a Flash game below to view the instructions.")

if game_choice contains "Bloxorz" then
	display dialog "You have selected: " & game_choice & ".  Please navigate to the correct page at this time, which can be found at http://www.miniclip.com/games/bloxorz/en/.  Once the Flash game is loaded and is on the menu, select the Start button to run the script.
	
After the script is activated, you will have 5 seconds to click inside Safari, and then again inside the game (just click an expty area).  This is required for the functions to work properly." buttons {"Quit", "Start"} default button 2
	if the button returned of the result is "Start" then
		tell application "System Events"
			tell process "Safari"
				delay 5
				keystroke tab
				keystroke return
				delay 2
				keystroke tab
				keystroke tab
				keystroke tab
				keystroke tab
				keystroke return
				delay 5
				keystroke (ASCII character 29)
				delay 0.5
				keystroke (ASCII character 29)
				delay 0.5
				keystroke (ASCII character 31)
				delay 0.5
				keystroke (ASCII character 29)
				delay 0.5
				keystroke (ASCII character 29)
				delay 0.5
				keystroke (ASCII character 29)
				delay 0.5
				keystroke (ASCII character 31)
			end tell
		end tell
	else
		-- quit script
	end if
	
end if

Thanks guys! :apple::apple::apple:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.