• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: set optionKeyDown to...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >set optionKeyDown to... (From: Robert Poland <email@hidden>)
 >Re: set optionKeyDown to... (From: Ed Stockly <email@hidden>)
 >Re: set optionKeyDown to... (From: Robert Poland <email@hidden>)
 >Re: set optionKeyDown to... (From: "Mark J. Reed" <email@hidden>)
 >Re: set optionKeyDown to... (From: Robert Poland <email@hidden>)
 >Re: set optionKeyDown to... (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Excel issues
  • Next by Date: Re: set optionKeyDown to...
  • Previous by thread: Re: set optionKeyDown to...
  • Next by thread: Re: set optionKeyDown to...
  • Index(es):
    • Date
    • Thread