Change customisation with a hotkey

I have a keystroke to call a Script A.
Refer to the hotkey as <*>
The script is contained here:
Customize > Keys tab > Script A entry (Checked, hotkey <*> assigned)

I have another Script B which has the same hotkey <*> but it is not checked i.e. is not active.
To change the hotkey action from (Script A > Script B) I need to go to
Customize > Keys tab
And then do the following

  • Uncheck Script A entry; and
  • Check Script B entry

Is it possible to create a button to do the above? Change hotkey assignment between Script A and B?

With thanks for any comments.....

Presumably the two hotkeys run a couple of custom commands, with each command added by one of the scripts?

So you could enable both scripts, and have a single hotkey which checks (for example) a variable and decides which command to run:

@ifset:$glob:MyHotkeyVar
Help ABOUT      // Command 1
@ifset:else
Go C:\          // Command 2

The same technique can be used to make a second hotkey (or toolbar button, etc.) which toggles the variable:

@ifset:$glob:MyHotkeyVar
@set glob:MyHotkeyVar
@ifset:else
@set glob:MyHotkeyVar=on

Or you could have separate buttons to turn the variable off and on:

@set glob:MyHotkeyVar
@set glob:MyHotkeyVar=on

If you want to use the toggle button on a toolbar or menu, and have it indicate which mode it is currently in, use this form so that it highlights when the variable is set:

@toggle:if $glob:MyHotkeyVar
@ifset:$glob:MyHotkeyVar
@set glob:MyHotkeyVar
@ifset:else
@set glob:MyHotkeyVar=on
@ifset:common
@toggle:update

Finally, individual off/on (rather than toggle) buttons that do highlighting, if you need them:

@toggle:if !$glob:MyHotkeyVar
@set glob:MyHotkeyVar
@toggle:update
@toggle:if $glob:MyHotkeyVar
@set glob:MyHotkeyVar=on
@toggle:update

Fantastic as usual a rich set of options from DOpus.
And very kindly supplied thanks @Leo
I will digest....

1 Like