Are you able to set a shortcut key to a variable change? In particular I am trying to set a key to change the Osnapz to change from 0 to 1 and then back with a push of the button.
For any System Variable for which the only valid values are 0 and 1, you can use a single operation to toggle between whatever the current value is and the other value [whether you assign it to a shortcut key, a toolbar button or other menu item, a command name, whatever]:
(setvar 'YourSystemVariableName (- 1 (getvar 'YourSystemVariableName)))
If it's currently 0, it ends up being set to 1, and vice versa.