Last active
June 17, 2024 19:12
-
-
Save mark05e/95e7097de92149d3487d61eab6816efc to your computer and use it in GitHub Desktop.
XML Notepad - Performs keyboard shortcuts to comment and uncomment nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Author: mark05e, Gemini/Bard (Large Language Model by Google) | |
; Description: Performs keyboard shortcuts to comment and uncomment nodes within XML Notepad. | |
; - Ctrl + / or Ctrl + K: Simulates menu key press followed by "h" and "o" keys (for commenting) | |
; - Ctrl + Shift + / or Ctrl + Shift + K: Simulates menu key press followed by "h" and "e" keys (for uncommenting) | |
; References: | |
; - https://www.reddit.com/r/AutoHotkey/comments/xrfk3c/mouse_right_click_and_select_an_action_from/ | |
; - https://github.com/microsoft/XmlNotepad/issues/396 | |
; - https://www.autohotkey.com/boards/viewtopic.php?t=38761 | |
; Hotkeys: | |
; - Ctrl + / | |
; - Ctrl + K | |
; - Ctrl + Shift + / | |
; - Ctrl + Shift + K | |
#Requires AutoHotkey v1.1+ <2.0 | |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#Warn ; Enable warnings to assist with detecting common errors. | |
#SingleInstance ; Ensures only one instance of the script is running. | |
; Show message box on tray click | |
OnMessage(0x404, "AHK_NOTIFYICON") | |
AHK_NOTIFYICON(wParam, lParam, uMsg, hWnd) | |
{ | |
if (lParam = 0x201) ;WM_LBUTTONDOWN := 0x201 | |
{ | |
DescriptionText = | |
( | |
This script performs keyboard shortcuts to comment and uncomment nodes within XML Notepad. | |
`n Ctrl + / or Ctrl + K: `n - Simulates menu key press followed by 'h' and 'o' keys (for commenting) | |
`n Ctrl + Shift + / or Ctrl + Shift + K: `n - Simulates menu key press followed by 'h' and 'e' keys (for uncommenting) | |
) | |
MsgBox, , Description, %DescriptionText%; | |
Reload | |
} | |
} | |
#IfWinActive ahk_exe XmlNotepad.exe ; Only listen to hotkey when XML Notepad is active window | |
; To comment xml nodes | |
^/:: ; Ctrl + / hotkey definition | |
^k:: ; Ctrl + K hotkey definition | |
Send, {Appskey} ; Send menu key | |
Send, h ; Send H key | |
Send, o ; Send O key | |
return | |
; To uncomment xml nodes | |
^+/:: ; Ctrl + Shift + / hotkey definition | |
^+k:: ; Ctrl + Shift + K hotkey definition | |
Send, {Appskey} ; Send menu key | |
Send, h ; Send H key | |
Send, e ; Send E key | |
return | |
#IfWinActive ; End of #IfWinActive block |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment