Applescript to keep a button pressed until I press it again?
A quite simple "self-regulating" way to switch between modifier keys WITHOUT being able to read their state could be to utilize their innate "effect" on a user's keyboard.
Write two scripts:

  [script 1:]  tell application "System Events" to shift key down

  [script 2:]  tell application "System Events" to shift key up


Toggling shift: apply a shortcut (e.g.) "option o" to the 1st script, "option shift o" to the 2nd one.   

Now, each time you press "option o" when calling the scripts, this will STILL toggle "shift" as "System Events" will receive "option shift o" in case of a previously active shift key ...    

(Another way might be to use a global variable  or even a plist file.)