Two ToolTips and Keyboard Layers are Toggled by Pressing a Key Combination

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
walt_the_dolt
Posts: 1
Joined: 19 Mar 2023, 21:28

Two ToolTips and Keyboard Layers are Toggled by Pressing a Key Combination

Post by walt_the_dolt » 19 Mar 2023, 21:54

I am trying to make an AHK script so that when I press control and `, my keys remap themselves like f::p and k::d. And then if I press the keycombo again (^`) then it toggles back to the orginal default key presses (I.E. f::f and k::k). Simultaneously, a ToolTip pops up when toggling back and forth that says "keys are default" or "keys are custom" depending on which one is true.


User avatar
mikeyww
Posts: 26877
Joined: 09 Sep 2014, 18:38

Re: Two ToolTips and Keyboard Layers are Toggled by Pressing a Key Combination

Post by mikeyww » 20 Mar 2023, 06:40

Welcome to this AutoHotkey forum!

Here is the same thing but with a toggle.

Code: Select all

; This script toggles a remap of multiple keys
#Requires AutoHotkey v2.0
remap := True
swap

^`::swap

#HotIf remap
f::p
k::d
#HotIf

swap() {
 Global remap
 If remap := !remap {
  ToolTip 'Keys are custom'
  SoundBeep 1500
 } Else {
  ToolTip 'Keys are default'
  SoundBeep 1000
 }
}

Post Reply

Return to “Ask for Help (v2)”