Holding a keystoke down

I am interested in using GUI Scripting to press and hold a keystroke for a certain period of time - likely 5 seconds. Does anyone know of a way to do this?

Hello bluemoose2k,

There are several different routes I could suggest, such as either employing System Events or Extra Suites, but I would need to know what specifically you would like to do. Also, have you searched on this site for “keystrokes”, “GUI”, etc… I believe you will find some useful threads. Please post what you wish to accomplish in more detail (including your particular OS and Script Editor version, if you will so far oblige me).


Variable as the shade

I’m trying to hold the “Option” key down while loading Entourage, in order to rebuild the Entourage mail database. The option key must be held down while Entourage is opened in order to accomplish this.

tell application “entourage”
tell application “system events”
key down option
delay 5
key up option
end tell
end tell

may work