On 23 Sep. 2016, at 12:05 pm, Robert Poland <email@hidden> wrote:
The intent is to catch a key down.
use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use framework "AppKit" use scripting additions
set optionDown to my checkModifier:"option" set shiftKeyDown to my checkModifier:"shift" set commandKeyDown to my checkModifier:"command" set controlKeyDown to my checkModifier:"control" if commandKeyDown and optionKeyDown and controlKeyDown then -- end if
on checkModifier:keyName if keyName = "option" then set theMask to current application's NSAlternateKeyMask as integer else if keyName = "control" then set theMask to current application's NSControlKeyMask as integer else if keyName = "command" then set theMask to current application's NSCommandKeyMask as integer else if keyName = "shift" then set theMask to current application's NSShiftKeyMask as integer else return false end if set theFlag to current application's NSEvent's modifierFlags() as integer return (((theFlag div theMask) mod 2) = 1) end checkModifier:
|