PDA

View Full Version : Apple Script Keystroke down ?




XPcentric
Apr 6, 2012, 07:20 AM
hey guys, I'm trying to make a script using Apple Script to repeat/loop keystroke down arrow while using Firefox, but as I dont use this program everyday I forgot all that I knew before and I find it easier to ask here for someone who uses daily and can make the script.

many thanks


tell application "Firefox"
activate
repeat
tell application "System Events"
keystroke downArrow
delay 2
end tel
end tell


obviously it doesnt work



ds0
Apr 6, 2012, 09:36 AM
keystroke doesn't respond unless you're talking to System Events, since it's using the Universal Access Assistive framework. Also, downArrow is a variable, not the actual keystroke for the down arrow. Since I can't think of the right one, just use the key code.

That said, just change your keystroke line to:

tell application "System Events" to tell process "Firefox" to key code 125

XPcentric
Apr 6, 2012, 11:57 AM
thank you, it works!