Re: Keystroke question
Re: Keystroke question
- Subject: Re: Keystroke question
- From: Shane Stanley <email@hidden>
- Date: Wed, 25 Nov 2015 12:15:06 +1100
On 24 Nov 2015, at 6:37 AM, Steve Mills <email@hidden> wrote:
Also keen in mind that any modifier keys the user might be holding when the script runs will be added to the "keystroke" command. That continually annoys me when I launch scripts via DragThing that type in my password or whatever, but I don't release the "launch that script" keys quickly enough.
Assuming you always use at least one of command or control, you could have your scripts pause until both are up. So start your scripts with something like:
use framework "Foundation"
set theMask to current application's NSCommandKeyMask as integer set otherMask to current application's NSControlKeyMask as integer repeat set theFlag to current application's NSEvent's modifierFlags() as integer if ((theFlag div theMask) mod 2) = 0 and ((theFlag div otherMask) mod 2) = 0 then exit repeat -- both keys up delay 1.0E-3 end repeat |
_______________________________________________
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