Page 1 of 2

Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 02 Oct 2013, 13:36
by FanaticGuru
Hotkey Help

This script creates a Hotkey Help dialog that shows all the Hotkeys found in all of the AHK files currently running.

It finds the names of all the running AHK programs through looking at Hidden Windows. This is done by a function that others might find useful. I have commentted this function at the end.

It then scans those AHK files for hotkeys and hotstrings.

It also scans those files for #Include and then recursively scans those files also.

It can detect compiled AHK EXE files but it can not scan them for hotkeys and those EXE would not contain any help comments so instead it looks for an AHK file with the same name as the EXE in the same location, working directory, or script directory; and scans it if found.

In a similar fashion Help will also look for a text file with the same names as the AHK script and get hotkey information and comments from that file if it exist.

You can change the settings within the running script and save your settings to an INI file.

There are various settings that can be adjusted and saved to the INI file.

You can also edit the script at the top to add specific files, hotkeys, and hotstrings to ignore.


UPDATED: Version 2.93

Link to CODE: Hotkey Help.ahk

SAMPLE DIALOG

Code: [Select all] [Expand] [Download] (SAMPLE DIALOG)GeSHi © Codebox Plus


To get a good looking dialog it is important to put a helpful comment after every hotkey in your scripts. Preferrable in a uniform format.

I do.

#a:: ; <--- This is a Sample Hotkey

The spacing between the :: and ; is not important as the script parses for the imformation and then spaces it uniformily.

Because it is using RegEx to attempt to identify Hotkeys it can probably be fooled. It attempts to weed out things that look like hotkeys but are not like text in comments or the use of :: in weird places.

Through information about values stored in variables that running scripts can be forced to report the Help attempts to evaluate the key definitions of hotkeys created with keys defined by variables. It is not always correct though because Help can only determine the current value of a variable which may not necessarily be the same as it was when a hotkey was created using that variable.

A raw view of hotkey combinations being used by all running scripts can be seen also. This information is retrieved from the running scripts directly so contains no comments but should pickup most all current hotkeys.

Also the main help dialog contains buttons for Stopping, Pausing, Suspending, Editing, Reloading and Opening scripts.

A text file can also be created with the same name as an AHK script that can contain help information without having to edit the actual AHK script. Txt is the default extension but custom extensions can be defined in the variable initialization of Hotkey Help. Sometimes when dealing with other peoples scripts it is easier to just put the help comments in a txt file especially if they update the script a lot causing it having to be re-commented each time it is updated.

These text help files need to contain a hotkey definition line with :: and ; similar to an actual hotkey definition line in a script. ie.
^#a:: ; <-- ~ Word ~ Save All Files
^#a:: ; <-- ~ Adobe ~ Authorization Stamp
^#b:: ; <-- Backup


FG

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 12 Mar 2014, 07:28
by AHKxx
This is fantastic and will help this noob enormously.

Thank you for sharing your work!

Wow. :D

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 29 Apr 2014, 12:33
by FanaticGuru
Updated in First Post

Change Log: Version 2.90 (2014-04-24)
Improved RegEx to better handle #include that has comment after command
Parser now looks for chain of circular #includes that would cause script to go into an infinite incursive loop

FG

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 10 Jun 2014, 01:57
by ozzii
I know I digg up a little old post.
I had an idea but no way that I'm doing it (I don't have the knowledge).
So here it is:
Something like this but as a lib. So when included it's lisling on the tray menu of the script the Active AHK Hotkeys and Hotstrings of the script.
Or maybe, if it's possible, something in an automatic way so we don't have to modify every script.

Am I clear enough? I'm not sure

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 10 Jun 2014, 14:48
by FanaticGuru
ozzii wrote:I know I digg up a little old post.
I had an idea but no way that I'm doing it (I don't have the knowledge).
So here it is:
Something like this but as a lib. So when included it's lisling on the tray menu of the script the Active AHK Hotkeys and Hotstrings of the script.
Or maybe, if it's possible, something in an automatic way so we don't have to modify every script.

Am I clear enough? I'm not sure

It is all doable.

I could probably add an option to this Hotkey Help script to modify the tray icons to display hotkeys and hotstrings.

My AHK Startup script already adds the ability to access some of this information from its tray icon.

Another possibility is adding a tooltip with the information to the tray icons but tooltips have a restrictive length limit.

The coding part is not so much the limit as the logistic part of how to arrange or display the information in the tray menu so it is not overly cluttered.

Hotstrings can be especially problematic to display on the tray icon menu because some scripts might contain a lot of hotstrings.

FG

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 11 Jun 2014, 03:11
by ozzii
Well I thought about just hotkeys sorry.
In that way, in the icon of the script we can see the hotkey for that script
I thought that the info is on the top of the tray menu.

I will test your "AHK Startup" script.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 14 Jun 2014, 12:34
by AHKxx
How can I make Hotkey Help use Notepad++ when it opens a script for editing?

I just did a clean installation of Windows 7, and the Hotkey Help script is using the native Windows Notepad. I'm pretty sure that previously it would open scripts in NPP. am I remembering that incorrectly, or have I just forgotten how to configure it for that?

Thanks again for this great script.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 14 Jun 2014, 22:40
by FanaticGuru
AHKxx wrote:How can I make Hotkey Help use Notepad++ when it opens a script for editing?

I just did a clean installation of Windows 7, and the Hotkey Help script is using the native Windows Notepad. I'm pretty sure that previously it would open scripts in NPP. am I remembering that incorrectly, or have I just forgotten how to configure it for that?

Thanks again for this great script.

That is not defined anywhere in my script. What editor is used is a Windows thing. It uses the default editor defined for AutoHotkey.

For example with me it opens up in SciTE4AutoHotkey.

I believe you have to change it in the register here:

HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command

FG

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 14 Jun 2014, 22:53
by AHKxx
ya i had looked to see if it was defined in the script and kind of suspected it wouldn't be.

But editing the registry key did it. Thanks.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 01 Aug 2014, 16:21
by DyNama
Pretty fantastic, FanaticGuru!

As i mentioned in another thread, i keep a keyboard map to track my used hotkeys, and i also maintain my own help screen, otherwise i'd forget what keys i assigned them to.
hotkey_help.jpg
My own help screen over top Hotkey Help

Your program will be a great help too! i did immediately have to exclude spellcheck program AutoCorrect for AHK-L.ahk, it's got hundreds of hotstrings in it, i don't need a list of those.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 25 Aug 2014, 15:21
by PJ_in_FL_USA
Hello!

My first post to AHK forum and I'd like to start by thanking FanaticGuru for sharing these tools with the community!

I created "AHK Startup.ahk" from the other source posted in that forum and have that script up and running using the subfolder format to load everything in my .\$Startup folder at one time. Great piece of code!

My request is to see if the .ahk source for "Hotkey Help.ahk" can be posted, too? I'm unable to access the link given in the original post.

Thanks again!
----------------------
PJ in FL

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 25 Aug 2014, 15:42
by FanaticGuru
PJ_in_FL_USA wrote:Hello!

My first post to AHK forum and I'd like to start by thanking FanaticGuru for sharing these tools with the community!

I created "AHK Startup.ahk" from the other source posted in that forum and have that script up and running using the subfolder format to load everything in my .\$Startup folder at one time. Great piece of code!

My request is to see if the .ahk source for "Hotkey Help.ahk" can be posted, too? I'm unable to access the link given in the original post.

Thanks again!
----------------------
PJ in FL


The link to the script code works fine for me. It might have just been a temporary internet thing.

I sent it to you in a private message.

If others have trouble with the link, I will include the code in the forums without a link. The script is pretty long and the link just makes it easier when I do an update but this script has matured and I do not need to update it very often now.

FG

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 03 May 2015, 10:26
by rommmcek
Bloody useful!
Brilliant idea!

greetings

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 21 Mar 2016, 20:16
by jdefgts
This is a really terrific and very useful program. I do have one problem with it that I can't seem to get around. Any insight that anyone has will be greatly appreciated. I am running Hotkey Help v. 2.90 as downloaded. In all of my scripts if I am using a hotstring to trigger an action, the help file always displays the ";" as part of the HS description so that this code:

Code: [Select all] [Download] GeSHi © Codebox Plus

::btw:: ; <-- Message "btw"
MsgBox You typed "btw".
return

produces the following listing in the help file:
<HS> btw = ; <-- Message "btw"

Is there something I can do to prevent the ";" from being displayed?

I really appreciate this board and the help I receive from it. Thanks!

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 22 Mar 2016, 00:36
by FanaticGuru
Updated in First Post

Change Log: Version 2.92 (2016-03-22)
Better handling of a hotstring defined to perform a custom action that has a comment after the hotstring trigger.

Example:

Code: [Select all] [Download] GeSHi © Codebox Plus

::btw:: ; <-- Message "btw"
MsgBox You typed "btw".
return

FG

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 22 Mar 2016, 07:17
by jdefgts
Thanks! That works perfectly. I really appreciate the rapid response.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 22 Mar 2016, 16:16
by derz00
That's a great script FG! Good work! Is there someone who has come up with a script that has what's on the top of the hotkey list? Like the list of all running scripts and do different things with them.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 22 Mar 2016, 19:05
by Guest
derz00 wrote:That's a great script FG! Good work! Is there someone who has come up with a script that has what's on the top of the hotkey list? Like the list of all running scripts and do different things with them.


https://autohotkey.com/board/topic/38653-see-running-autohotkey-scripts-and-end-them/

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 24 Oct 2016, 10:00
by Guest
How can I make the display context senitive? I would like to display only the macros relevant to the currently active window.

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Posted: 24 Oct 2016, 12:49
by FanaticGuru
Guest wrote:How can I make the display context senitive? I would like to display only the macros relevant to the currently active window.

There is no easy way to do this because there is no easy way to determine what macros are relevant to what windows. Even with the #if command being used AutoHotkey does not evaluate the #if command until the hotkey is pressed. The #if can also be dynamic like #if (Toggle = true). So doing it by analyzing the code is impractical to impossible.

You could add a remark to the end of every hotkey line in your scripts with the WinTitle that you wanted the hotkey to only be displayed if active and then parse that information out and use it to control the display of information in the Help dialog.
Something like ^f12:: ; <--- Generic Description ~ahk_class Notepad~.

It would be cumbersome and quite a bit of work to implement properly.

FG