Skip to content

Instantly share code, notes, and snippets.

@fractaledmind
Created October 22, 2013 16:22
Show Gist options
  • Select an option

  • Save fractaledmind/7103658 to your computer and use it in GitHub Desktop.

Select an option

Save fractaledmind/7103658 to your computer and use it in GitHub Desktop.
This script uses a simple utility called "checkModifierKeys", which can be found here: http://macscripter.net/viewtopic.php?pid=114479#p114479, to determine whether or not one of the modifier keys is being pressed. This proves very helpful for adding deeper functionality to your Applescripts
(* CHECK MODIFIER KEYS
REQUIREMENTS:
- the checkModifierKeys utility, which needs to be in your Utilities folder. To download, visit here: http://macscripter.net/viewtopic.php?pid=114479#p114479
*)
set buttonOptions to {"cmd", "option", "control", "shift", "capslock"}
set p2u to POSIX path of (path to utilities folder)
set res to do shell script p2u & "checkModifierKeys " & item 4 of buttonOptions
if res = "0" then return false
if res = "1" then return true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment