Re: set optionKeyDown to...
Re: set optionKeyDown to...
- Subject: Re: set optionKeyDown to...
- From: Robert Poland <email@hidden>
- Date: Thu, 11 Sep 2008 16:38:32 -0600
Thanks Mark,
Got it to work.
tell application "KeyboardViewerServer" to activate -- start earlier in script to speed things up ... tell application "System Events" set optionKeyDown to (get value of checkbox "⌥" of window 1 of application process "KeyboardViewerServer") as boolean tell application "KeyboardViewerServer" to quit end tell
Couldn't crack the code to use "checkbox" numbers but the graphic seems to work.
Now if I could just get KeyboardViewerServer to start in a timely manner so I wouldn't have to have it run at startup.
On Sep 11, 2008, at 12:27 PM, Mark J. Reed wrote: Interestingly enough, the technique for detecting a key down reportedly works even without the window being visible. On Thu, Sep 11, 2008 at 2:05 PM, Robert Poland < email@hidden> wrote: Looks interesting.
So far I can't get KeyboardViewerServer to show a window.
I'll keep trying after lunch.
tell application "System Events"
tell application "KeyboardViewerServer" to activate
set CTRL to (get value of checkbox 63 of window 1 of application process
"KeyboardViewerServer") as number
if CTRL is 1 then
tell application "TextEdit" to activate
repeat until CTRL is 0
set CTRL to (get value of checkbox 63 of window 1 of application process
"KeyboardViewerServer") as number
keystroke "1"
end repeat
end if
return 1
end tell
On Sep 11, 2008, at 11:44 AM, Mark J. Reed wrote:
So you want to detect if the option key is currently being pressed.
One way I've heard to do this is by using the KeyboardViewerServer and
GUI scripting to see if the key is highlighted.
Bob Poland - Fort Collins, CO
-- Mark J. Reed < email@hidden>
Bob Poland - Fort Collins, CO
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden