Hotkey docstrings

Propose new features and changes
john_c
Posts: 320
Joined: 05 May 2017, 13:19

Hotkey docstrings

08 Nov 2019, 01:30

It would be nice to have docstrings for hotkeys. Example:

Code: Select all

F1:: ; Show Foo message
    MsgBox,,, % "Foo"
Return

F2:: ; Show Bar message
    MsgBox,,, % "Bar"
Return

F11::
ExitApp
These docstring should be automatically collected in the tray menu:

Code: Select all

Open
Help
Hotkeys of This Script <-- new item
-------
Window Spy
Reload This Script
Edit This Script
-------
Suspend Hotkeys
Pause Script
Exit
Select "Hotkeys of This Script" item. It will be opened a special window with a list of all docstringed hotkeys, i.e.

Code: Select all

F1 - Show Foo message
F2 - Show Bar message
Something like a cheat sheet for your script.
aifritz
Posts: 157
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: Hotkey docstrings

08 Nov 2019, 03:58

Please try it in this way:

Code: Select all

Menu, Submenu, add, F1 - Show Foo message, F1 ;first add all items to the menu. 
Menu, Submenu, add, F2 - Show Bar message, F2  
Menu, Submenu, add, F11 - ExitApp, F11
Menu, tray, add, Hotkeys of This Script, :Submenu ;then add the menu to the tray as a submenu 

F1:: ; Show Foo message
    MsgBox,,, % "Foo"
Return

F2:: ; Show Bar message
    MsgBox,,, % "Bar"
Return

F11::
ExitApp
john_c
Posts: 320
Joined: 05 May 2017, 13:19

Re: Hotkey docstrings

08 Nov 2019, 07:30

@aifritz Thank you for useful code. It works, but it is necessary to maintain a separate list: it is less convenient because you need to check the consistency. For example, if you change F2:: to F12::, it will be necessary to reflect this change in the menu. In case of docstrings it will be reflected automatically.
aifritz
Posts: 157
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: Hotkey docstrings

08 Nov 2019, 07:47

Yes, I agree with you. :roll:
An other sugesstion maybe to include a script, that is running once at the start, looking for all hotkeys including explanations, that built's up the menu and then reloads the script...

Edit: Another issue may be context sensitive hotkeys created with #IfWinActive. Here serveral hotkeys may have the same trigger key/combination. What hotkey should be displayed here in the menu?
ahk7
Posts: 210
Joined: 06 Nov 2013, 16:35

Re: Hotkey docstrings

08 Nov 2019, 12:06

Hotkey Help - Display Active AHK Hotkeys and Hotstrings
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=96
?
john_c
Posts: 320
Joined: 05 May 2017, 13:19

Re: Hotkey docstrings

09 Nov 2019, 00:33

@ahk7 Yes, its Win+F1 does something similar. However:

* It shows hotkeys of all running scripts (instead of hotkeys of the current script only)
* It doesn't show what a particular hotkey does
* It is a separate script with a lot of other functions. I talk about a small and neat built-in enhancement.

Return to “Wish List”

Who is online

Users browsing this forum: Google [Bot] and 15 guests