Hi,
I'm using a lot of hotkeys in my ahk. That many that I'm having trouble remembering all of them and what they do.
I'm looking for yet another hotkey that will list all the hotkeys and their function used in the .ahk. I'm aware of the "Hotkeys and their Methods" feature under "View" in the AHK application. But the problem is that this doesn't show their function.
"Hotkeys and their Methods" look like this:
Type Off? Level Running Name
-------------------------------------------------------------------
reg !1
reg ^+!1
reg ^+2
reg !2
reg !3
....
In my .ahk I include a small function summary/description after the hotkey. IE:
!8:: ;Add /24 ip-address to _VLAN_01_untagged
^numpad2:: ;Firefox url
I might be looking for a script that can read the ahk file, search for all the hotkeys (maybe it can search the :: after the hotkey) and output that entire line associated with each hotkey in a msgbox or something.
Or maybe someone has a better idea? Can someone help me out?
Kind regards.
Output list of all hotkeys used in ahk Topic is solved
Re: Output list of all hotkeys used in ahk
"Hotkey Help - Display Active AHK Hotkeys and Hotstrings" could be what you are searching for.
https://autohotkey.com/board/topic/9388 ... otstrings/
Try the sample an press Win+F1 for the Hotkey-Overview-Window
I think you only have to change to comments you already have in your code
Greetings
Rob
https://autohotkey.com/board/topic/9388 ... otstrings/
Try the sample an press Win+F1 for the Hotkey-Overview-Window
I think you only have to change to comments you already have in your code
Greetings
Rob
Re: Output list of all hotkeys used in ahk
Code: Select all
; autoexecute section:
Gui, -Caption
Gui, Add, ListBox, vMyListBox r50 w200
Loop, Read, %A_ScriptFullpath%
{
If !InStr(A_LoopReadLine, ":: `;")
continue
StringReplace, ReadLine, A_LoopReadLine, %A_Space%`;, %A_Tab%
GuiControl,, MyListBox, %ReadLine%
}
; ...
return ; end of autoexecute section
; Hotkey to show|hide the GUI:
F2:: ; Gui hotkeys
If (toggle := !toggle)
Gui, Show, x0 y0
else
Gui, cancel
return
Re: Output list of all hotkeys used in ahk
Thanks Rob, That one is a bit too complicated for me though!robmar-zl wrote:"Hotkey Help - Display Active AHK Hotkeys and Hotstrings" could be what you are searching for.
https://autohotkey.com/board/topic/9388 ... otstrings/
Try the sample an press Win+F1 for the Hotkey-Overview-Window
I think you only have to change to comments you already have in your code
Greetings
Rob
This is perfect! It shows the lines with all the hotkeys and the comments.GEV wrote:Code: Select all
; autoexecute section: Gui, -Caption Gui, Add, ListBox, vMyListBox r50 w200 Loop, Read, %A_ScriptFullpath% { If !InStr(A_LoopReadLine, ":: `;") continue StringReplace, ReadLine, A_LoopReadLine, %A_Space%`;, %A_Tab% GuiControl,, MyListBox, %ReadLine% } ; ... return ; end of autoexecute section ; Hotkey to show|hide the GUI: F2:: ; Gui hotkeys If (toggle := !toggle) Gui, Show, x0 y0 else Gui, cancel return
One thing though: I cant seem to get the pop up window wider than 100 pixels. So it can't show all the comments in full.
Gui, Show, x0 y0 w200 does make the window 200 pixels wide but the actual field with text stays the same about 100 pixels the rest is grayed out.
Gui, Show, x0 y0 Maximize wields the same results but now the grayed out part is maximized. AutoSize doesnt change it at all. Do you maybe have a solution for that part?
Thanks so much already, truly love this community.
Re: Output list of all hotkeys used in ahk
To change the width of the ListBox, change the last parameter of the command:
Gui, Add, ListBox, vMyListBox r50 w200
to e.g. w300
Gui, Add, ListBox, vMyListBox r50 w200
to e.g. w300
-
- Posts: 33
- Joined: 09 Apr 2016, 22:14
Re: Output list of all hotkeys used in ahk
https://www.autohotkey.com/docs/command ... otkeys.htm
Displays the hotkeys in use by the current script, whether their subroutines are currently running, and whether or not they use the keyboard or mouse hook.
This command is equivalent to selecting the View->Hotkeys menu item in the main window.
Code: Select all
ListHotkeys
This command is equivalent to selecting the View->Hotkeys menu item in the main window.
Last edited by robertcollier4 on 22 Jun 2017, 00:17, edited 1 time in total.
- FanaticGuru
- Posts: 1908
- Joined: 30 Sep 2013, 22:25
Re: Output list of all hotkeys used in ahk Topic is solved
Hotkey Help does exactly what you describe.MrShhh wrote:Thanks Rob, That one is a bit too complicated for me though!robmar-zl wrote:"Hotkey Help - Display Active AHK Hotkeys and Hotstrings" could be what you are searching for.
https://autohotkey.com/board/topic/9388 ... otstrings/
Try the sample an press Win+F1 for the Hotkey-Overview-Window
I think you only have to change to comments you already have in your code
Greetings
Rob
Below is a current link:
https://autohotkey.com/boards/viewtopic.php?f=6&t=96
The code might be complicated but its use is simple. Just run the script and press Win+F1 to get a list of all AHK scripts running and the hotkeys in those scripts along with the comment on the same line as the hotkey. The beauty of Hotkey Help is that it is an independent script that finds the hotkeys of all other running scripts. If you have 20 scripts running it will list the hotkeys in all of them without having to put code in each script.
If you want something more lightweight for only the script that is doing the display, you can try this function that basically does what GEV is doing in a little more robust way and also expands the modifier keys symbols to words.
Code: Select all
; autoexecute section:
Gui, -Caption
Gui, Add, ListView,, HOTKEY|COMMENT
for Index, Element in Hotkeys(Hotkeys)
LV_Add("",Element.Hotkey, Element.Comment)
LV_ModifyCol()
; Hotkey to show|hide the GUI:
^#F12:: ; Gui hotkeys
If (Toggle := !Toggle)
Gui, Show, x0 y0
else
Gui, Cancel
return
; Read Hotkeys from Script File
Hotkeys(ByRef Hotkeys)
{
FileRead, Script, %A_ScriptFullPath%
Script := RegExReplace(Script, "ms`a)^\s*/\*.*?^\s*\*/\s*|^\s*\(.*?^\s*\)\s*")
Hotkeys := {}
Loop, Parse, Script, `n, `r
if RegExMatch(A_LoopField,"^\s*(.*):`:.*`;\s*(.*)",Match)
{
if !RegExMatch(Match1,"(Shift|Alt|Ctrl|Win)")
{
StringReplace, Match1, Match1, +, Shift+
StringReplace, Match1, Match1, <^>!, AltGr+
StringReplace, Match1, Match1, <, Left, All
StringReplace, Match1, Match1, >, Right, All
StringReplace, Match1, Match1, !, Alt+
StringReplace, Match1, Match1, ^, Ctrl+
StringReplace, Match1, Match1, #, Win+
}
Hotkeys.Push({"Hotkey":Match1, "Comment":Match2})
}
return Hotkeys
}
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Re: Output list of all hotkeys used in ahk
Thank you all very much for the responses. Its working great! This is what my script looks like now:
I then used the option to have the Listview window options under a hotkey as well because I'm now using more then one ListViews in the same script and the set windows sizes kept interfering with each other. The feature "Gui, destroy" is implemented to make it 'forget' the window sizes as soon as the script is completed. That code looks like this:
Code: Select all
Hotkeys(ByRef Hotkeys)
{
if (A_ComputerName = "Computer") {
FileRead, Script, %A_ScriptFullPath%
}
If (A_ComputerName = "Laptop") {
FileRead, Script, %A_ScriptFullPath%
}
Script := RegExReplace(Script, "ms`a)^\s*/\*.*?^\s*\*/\s*|^\s*\(.*?^\s*\)\s*")
Hotkeys := {}
Loop, Parse, Script, `n, `r
if RegExMatch(A_LoopField,"^\s*(.*):`:.*`;\s*(.*)",Match)
{
if !RegExMatch(Match1,"(Shift|Alt|Ctrl|Win)")
{
StringReplace, Match1, Match1, +, Shift+
StringReplace, Match1, Match1, <^>!, AltGr+
StringReplace, Match1, Match1, <, Left, All
StringReplace, Match1, Match1, >, Right, All
StringReplace, Match1, Match1, !, Alt+
StringReplace, Match1, Match1, ^, Ctrl+
StringReplace, Match1, Match1, #, Win+
}
Hotkeys.Push({"Hotkey":Match1, "Comment":Match2})
}
return Hotkeys
}
Code: Select all
F1:: ; Gui Hotkeys
Gui, Add, ListView, h700 w500, HOTKEY|COMMENT
LV_ModifyCol(1, 125)
LV_ModifyCol(2, 375)
for Index, Element in Hotkeys(Hotkeys)
LV_Add("",Element.Hotkey, Element.Comment)
If (Toggle := !Toggle)
Gui, Show, x0 y0
else
Gui, Destroy
return
I couldn't get the auto size to work but having a fixed window size works as well. Thanks for pointing out ListView, I like it a lot!FanaticGuru wrote: It also uses a ListView instead of a ListBox which auto sizes and aligns things in columns better.
- FanaticGuru
- Posts: 1908
- Joined: 30 Sep 2013, 22:25
Re: Output list of all hotkeys used in ahk
Code: Select all
if (A_ComputerName = "Computer") {
FileRead, Script, %A_ScriptFullPath%
}
If (A_ComputerName = "Laptop") {
FileRead, Script, %A_ScriptFullPath%
}
As for multiple GUI, you just use names for the GUI which is easy to do with the Default option.
Code: Select all
; autoexecute section:
Gui, ThisGui:Default
Gui, -Caption
Gui, Add, ListView,, HOTKEY|COMMENT
for Index, Element in Hotkeys(Hotkeys)
LV_Add("",Element.Hotkey, Element.Comment)
LV_ModifyCol()
Gui, ThatGui:Default
Gui, -Caption
Gui, Add, ListView,, HOTKEY|COMMENT
for Index, Element in Hotkeys(Hotkeys)
LV_Add("",Element.Hotkey, Element.Comment)
LV_ModifyCol()
; Hotkey to show|hide the GUI:
^#F12:: ; Gui hotkeys, ThisGUI
If (Toggle1 := !Toggle1)
Gui, ThisGui:Show, x0 y0
else
Gui, ThisGui:Cancel
return
^#F11:: ; Gui hotkeys, ThatGUI
If (Toggle2 := !Toggle2)
Gui, ThatGui:Show, x200 y200
else
Gui, ThatGui:Cancel
return
; Read Hotkeys from Script File
Hotkeys(ByRef Hotkeys)
{
FileRead, Script, %A_ScriptFullPath%
Script := RegExReplace(Script, "ms`a)^\s*/\*.*?^\s*\*/\s*|^\s*\(.*?^\s*\)\s*")
Hotkeys := {}
Loop, Parse, Script, `n, `r
if RegExMatch(A_LoopField,"^\s*(.*):`:.*`;\s*(.*)",Match)
{
if !RegExMatch(Match1,"(Shift|Alt|Ctrl|Win)")
{
StringReplace, Match1, Match1, +, Shift+
StringReplace, Match1, Match1, <^>!, AltGr+
StringReplace, Match1, Match1, <, Left, All
StringReplace, Match1, Match1, >, Right, All
StringReplace, Match1, Match1, !, Alt+
StringReplace, Match1, Match1, ^, Ctrl+
StringReplace, Match1, Match1, #, Win+
}
Hotkeys.Push({"Hotkey":Match1, "Comment":Match2})
}
return Hotkeys
}
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Re: Output list of all hotkeys used in ahk
I use the same script on two different computers, I was under the assumption I had to replace %A_ScriptFullPath% with the full path tot the script. Your comment made me realise this is a feature on its own... ... ... ...FanaticGuru wrote:I don't really understand this part. Regardless of A_ComputerName the script is going to do the exact same thing. I guess if A_ComputerName is not either one of those the function will return nothing but there are more straight forward ways of having the script return nothing.Code: Select all
if (A_ComputerName = "Computer") { FileRead, Script, %A_ScriptFullPath% } If (A_ComputerName = "Laptop") { FileRead, Script, %A_ScriptFullPath% }
I have tried this and as you can see the script does have a name (and the second one a different name), however when loading one after the other the second one keeps the settings from the first one. Gui destroy solves this.As for multiple GUI, you just use names for the GUI which is easy to do with the Default option.FGCode: Select all
; autoexecute section: Gui, ThisGui:Default Gui, -Caption Gui, Add, ListView,, HOTKEY|COMMENT for Index, Element in Hotkeys(Hotkeys) LV_Add("",Element.Hotkey, Element.Comment) LV_ModifyCol() Gui, ThatGui:Default Gui, -Caption Gui, Add, ListView,, HOTKEY|COMMENT for Index, Element in Hotkeys(Hotkeys) LV_Add("",Element.Hotkey, Element.Comment) LV_ModifyCol() ; Hotkey to show|hide the GUI: ^#F12:: ; Gui hotkeys, ThisGUI If (Toggle1 := !Toggle1) Gui, ThisGui:Show, x0 y0 else Gui, ThisGui:Cancel return ^#F11:: ; Gui hotkeys, ThatGUI If (Toggle2 := !Toggle2) Gui, ThatGui:Show, x200 y200 else Gui, ThatGui:Cancel return ; Read Hotkeys from Script File Hotkeys(ByRef Hotkeys) { FileRead, Script, %A_ScriptFullPath% Script := RegExReplace(Script, "ms`a)^\s*/\*.*?^\s*\*/\s*|^\s*\(.*?^\s*\)\s*") Hotkeys := {} Loop, Parse, Script, `n, `r if RegExMatch(A_LoopField,"^\s*(.*):`:.*`;\s*(.*)",Match) { if !RegExMatch(Match1,"(Shift|Alt|Ctrl|Win)") { StringReplace, Match1, Match1, +, Shift+ StringReplace, Match1, Match1, <^>!, AltGr+ StringReplace, Match1, Match1, <, Left, All StringReplace, Match1, Match1, >, Right, All StringReplace, Match1, Match1, !, Alt+ StringReplace, Match1, Match1, ^, Ctrl+ StringReplace, Match1, Match1, #, Win+ } Hotkeys.Push({"Hotkey":Match1, "Comment":Match2}) } return Hotkeys }
Mr. Shhh
Who is online
Users browsing this forum: Marium0505, mcl and 348 guests