RE: Non-character keystrokes
RE: Non-character keystrokes
- Subject: RE: Non-character keystrokes
- From: "Scott Babcock" <email@hidden>
- Date: Sat, 7 May 2005 21:54:22 -0700
- Thread-topic: Non-character keystrokes
To type non-character keys, use the System Events 'key code' event:
-- press F1
tell application "System Events" to key code 122
I don't know where to find comprehensive documentation on the key codes,
but each key on the keyboard has a unique code. You can use PreFab's UI
Browser to get the codes. Just open up the Keystrokes drawer and press
the key you want. (Press <cmd-3> to open the drawer.)
If you're trying to automate the UI and you don't have UI Browser,
you're missing out on a fabulous tool. Go to http://www.prefab.com to
get it.
Also, if you need to type a key with more than one modifier, you can
specify a list of modifiers for the [using] argument of the 'keystroke'
event:
-- open the Colors dialog of TextEdit
tell application "System Events"
keystroke "c" using {command down, shift down}
end tell
-- Scott
-----Original Message-----
Date: Fri, 6 May 2005 16:42:26 -0400
From: "Marc K. Myers" <email@hidden>
Subject: Non-character keystrokes
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed
I'm trying to script System Event's "keystroke" command to simulate
pressing one of the function keys. So far I haven't been able to find
how to code for keystrokes for non-character keys. Is this possible?
Marc [5/6/05 4:42:14 PM]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden