Register a modifier key?

Hey all;

Is it possible to launch a script, hold own a modifier and have the script run an if statement based on whether that modifier key is held down or not?

I would guess it’s somewhere in system events, but I don’t know how I’d set it up.

Thanks!

dt

Browser: Safari 525.13
Operating System: Mac OS X (10.5)

Not with a regular AppleScript (maybe with AppleScript Studio).

Does this help?

Handle with care… you may need to log out and back to regain control of your keyboard if you make modifications.

Peter B.



tell application "System Events"
	key down shift
	set shift_down to true
end tell

if shift_down is true then
	tell me to activate
	display dialog "Shift Down" buttons {"OK"} default button 1
end if

delay 5

tell application "System Events"
	key up shift
end tell

tell me to activate
display dialog "Shift Up" buttons {"OK"} default button 1