• 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: Detecting a keydown or key up.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting a keydown or key up.


  • Subject: Re: Detecting a keydown or key up.
  • From: Luther Fuller <email@hidden>
  • Date: Tue, 02 Aug 2011 13:17:55 -0500

On Aug 2, 2011, at 10:25 AM, Zavatone, Alex wrote:

I've been looking around with google and wonder if, in this modern age, we still have to monkey around to detect a key's state?  Particularly the modifier keys?

I've just been looking at this in AppleScript's dictionary ...

keystroke n : a press of a key combination on a Macintosh keyboard

properties
key character, r/o : the character for the key was pressed (ignoring modifiers)
modifiers list of option down | command down | control down | shift down | caps lock down, r/o : the modifier keys pressed in combination
key kind escape key | delete key | tab key | return key | clear key | enter key | up arrow key | down arrow key | left arrow key | right arrow key | help key | home key | page up key | page down key | forward del key | end key | F1 key | F2 key | F3 key | F4 key | F5 key | F6 key | F7 key | F8 key | F9 key | F10 key | F11 key | F12 key | F13 key | F14 key | F15 key, r/o : the kind of key that was pressed

But ... it seems to be brain dead. The only thing that didn't error was

get modifiers

which returns {command key} when run from the editor. Always.
Preceding 'get modifiers' with a delay returns {command key} even if the Option key is down.

If run as an application, it always returns the error "Can't get modifiers".

Or, perhaps I'm using this incorrectly. Anyone know the correct syntax for this?

 _______________________________________________
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

  • Follow-Ups:
    • Re: Detecting a keydown or key up.
      • From: "Zavatone, Alex" <email@hidden>
References: 
 >Detecting a keydown or key up. (From: "Zavatone, Alex" <email@hidden>)

  • Prev by Date: Re: Detecting a keydown or key up.
  • Next by Date: Re: Detecting a keydown or key up.
  • Previous by thread: Re: Detecting a keydown or key up.
  • Next by thread: Re: Detecting a keydown or key up.
  • Index(es):
    • Date
    • Thread