Simulating key presses...

i have been trying to create an apple script which when run would simulate the pressing of a certain key…the left arrow for example…but i can’t seem to find a way…can anybody help?

try using extra suites v 1.1 for applescript www.kanzu.com

I made this code using it.

property theTicks : 200

tell application "Extra Suites"
	ignoring application responses
		ES type key "tab" with command
		tell application "iKey" to activate
		ES pause theTicks
		ES set screen resolution width 1024 height 768
		ES pause theTicks
		ES type key "j" with command and option
		ES pause theTicks
		ES type key "k" with command and option
		ES pause theTicks
		ES pause theTicks
		tell application "iKey" to quit
	end ignoring
end tell

If you are running the script on a Mac that has GUI Scripting enabled, this snippet should simulate the left arrow key. You’ll need to make sure that the target application is frontmost/active so that it receives the command.

tell application "System Events" to keystroke (ASCII character 28)

– Rob (a big fan of Extra Suites)

Whats the acsii for escape?

ESC → ascii 27. Check out [url=http://www.asciitable.com/]http://www.asciitable.com/[/url]

j

There’s a handy app that shows the ASCII equivalent to a keystroke or key combination. Visit the software section of RAILhead Design and look for ASCIIseek.

– Rob