VERY new to scripting and need to know if this is possible..

Hi, I’m Trevor! I just got my MacBook Pro a few weeks ago and I LOVE it…

I’m playing a game on my computer, and for certain moves it uses keystrokes, and I need to be able to press left, diagonal down-left, down, diagonal down-right, right, in that order in this game and I was wondering if it’s possible with AppleScript to simply make when I press Option+Z it would press these five arrow directions really quick…

Is this possible?

If you’re kind of confused by this post, it’s basically I want to be playing the game and press the Option/Alt button together with the Z button for a Opt+Z key combination and when I do that I want down, diagonal down-left, down, diagonal down-right, then right to be pressed automatically, so it will do the moves for me basically (kind of like a small macro…)

And if it’s not possible with JUST applecript, I have a program called simplekeys that can set an applescript to a key combination, so if it’s at all possible just to have an applescript that presses the arrow directions, then I can set this applescript to Opt+Z with simplekeys, so I just need that simple script that will press those directions for me…

If so can anyone tell me what the script would be? I have other key combinations I need to be pressed for other moves, but if I can get this one I think I can edit it as needed… thanks so much!



P.S. EXCITED to be part of a Mac forum :slight_smile:

sounds like what you need would be much better accomplished with a commercial program like USB OverDrive or similar which is specifically designed to support devices and keystrokes etc for games. I’m not sure if that one does key macros like that.

If you want to go the applescript route, you can search for GUI access scripting. with that you can emulate keystrokes. But I doubt it will be fast enough to do what you need for a game.

Actually it’s better if it doesn’t do the keystrokes SUPER fast so that would be perfect… point me in the right direction? I’m searching as we speak

My arrow keys are up down left right. What is “diagonal down-right”

it’s the diagonal direction between down and right or down and left… there isn’t a key for it you roll your fingers between the two

ttt, need help fellas

and bump again…


here a sample script to do keystrokes.
Replace myGame with the name of the gane

activate application "myGame"
tell application "System Events"
	tell process "myGame"
		key code 125 -- arrow down
		delay 0.5
		key code 123 -- arrow left
		delay 0.5
		key code 126 -- arrow up
		key code 124 -- arrow right
	end tell
end tell