Search code examples
nativeautohotkeytilde

Remap hotkey without losing native hotkey functionality


I want the keyboard shortcut ctrl+tab to perform two functions:

  1. ctrl+tab (its normal function, e.g., to switch tabs in a web browser)
  2. ctrl+F6 (which can be used to switch between Microsoft Word documents, for example)

It doesn't need to be context-sensitive, i.e., it's okay to send both commands regardless of what program(s) I am using. The closest I have come is the following:

~^Tab::^F6

which performs both of the desired functions, but a "Tab" keystroke is also sent along with the hotkey. (This would wreak havoc on my Word documents!) I need to preserve the native ctrl+tab functionality without sending a Tab keystroke. Could someone please help?


Solution

  • Then just send both commands:

    $^Tab::
        Send, ^{F6}
        sleep,50
        Send, ^{Tab}
    return
    

    Just note that some programs might not like that.