• 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: "Zavatone, Alex" <email@hidden>
  • Date: Tue, 02 Aug 2011 12:50:09 -0700
  • Acceptlanguage: en-US
  • Thread-topic: Detecting a keydown or key up.


On Aug 2, 2011, at 1:17 PM, Luther Fuller wrote:

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?

I think this explains it:

modifiers

modifiers (enumeration)the modifier keys pressed in combination

 constants

Constant
Description
caps lock down
command down
control down
option down
shift down

 where used

The modifiers enumeration is used in the following ways:
modifiers property of the keystroke class/record

This email message and any attachments are for the sole use of the intended recipient(s) and may contain information that is proprietary to U.S. Foodservice, Inc and/or its subsidiaries or otherwise confidential or legally privileged. If you have received this message in error, please notify the sender by reply, and delete all copies of this message and any attachments. If you are the intended recipient you may use the information contained in this message and any files attached to this message only as authorized by U.S. Foodservice. Files attached to this message may only be transmitted using secure systems and appropriate means of encryption, and must be secured using the same level password and security protection with which the file was provided to you. Any unauthorized use, dissemination or disclosure of this message or it's attachments is strictly prohibited.

 _______________________________________________
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: Luther Fuller <email@hidden>
References: 
 >Detecting a keydown or key up. (From: "Zavatone, Alex" <email@hidden>)
 >Re: Detecting a keydown or key up. (From: Luther Fuller <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