Ah sorry,
My script I try to run is
Code:
; http://www.autohotkey.com/forum/topic215.html
;*******************************************************************************
; Extract a list of Hotstrings and Hotkeys from this script and display them
;*******************************************************************************
; Modified by Vixay Xavier on Sat October 11, 2008 06:02:29 PM
; Modified by infogulch on Mon September 21, 2009 08:30:00 PM
; Modified by infogulch on Tue September 22, 2009 03:00:00 PM
; Modified by Bousch on 2010-02-09 18:13
; changed view to listview
; added sorting with ctrl-1 (name) and Ctrl-2 (text)
; activate hotkey with enter or dblclick
;#SingleInstance force
keylist=
ShowListView:
Gui, Destroy
Gui, Add, ListView, xm r40 w450 Grid vMyListView gMyListView AltSubmit, Name|Text|key
Gui, Add, Button, Hidden Default, OK
split_chars := "¬"
loop, parse, keylist, `n, `r
{
; initialize vars because stringsplit doesn't
key_array1 =
key_array2 =
key_array3 =
StringSplit, key_array, A_LoopField, %split_chars%
; rows below remove spaces before and after
Name = %key_array1%
Desc = %key_array2%
Hk = %key_array3%
If (Name != "")
LV_Add("", Name, Desc, Hk)
}
LV_ModifyCol() ; Auto-size each column to fit its contents.
LV_ModifyCol(1, "Sort")
Gui, +Resize
Gui, Show,,AHK-Help
return
MyListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(hk_label, A_EventInfo, 3)
RunHK(hk_label)
}
; Sort with ^1 and ^2
if A_GuiEvent = K
{
ControlState := GetKeyState("Ctrl")
if (ControlState = 1)
{
if (A_EventInfo = 49)
{
; 1 pressed
if sorted = 1
{
LV_ModifyCol(1, "SortDesc")
sorted := 0
} else {
LV_ModifyCol(1, "Sort")
sorted := 1
}
} else {
if (A_EventInfo = 50)
{
if sorted = 2
{
LV_ModifyCol(2, "SortDesc")
sorted := 0
} else {
LV_ModifyCol(2, "Sort")
sorted := 2
}
}
}
}
}
return
GuiSize: ; Expand or shrink the ListView in response to the user's resizing of the window.
if A_EventInfo = 1 ; The window has been minimized. No action needed.
return
; Otherwise, the window has been resized or maximized. Resize the ListView to match.
GuiControl, Move, MyListView, % "W" . (A_GuiWidth - 20) . " H" . (A_GuiHeight - 20) ;%
return
ButtonOK:
GuiControlGet, FocusedControl, FocusV
if FocusedControl <> MyListView
return
LV_GetText(hk_label, LV_GetNext(0, "Focused"), 3)
RunHK(hk_label)
Return
GuiEscape:
Gui, Cancel
Return
RunHK(label) {
if IsLabel(label)
{
Gui, Cancel
Gosub, %label%
}
else
{
MsgBox %label%
}
}
;===============================================================
ViewKeyListFromHK( scriptfile ) {
global keylist
keylist := FormatKeyListFile(scriptfile)
Gosub ShowListView
}
FormatKeyListFile( scriptfile, force = False ) {
; this function reads scriptfile and returns a formatted string from FormatKeyList
; it automatically caches the most recent formatted result so it doesn't have to reparse it
; pass force = True to force it to reread and reparse the scriptfile
static file, formatted
if (file != scriptfile) && !Force
{
fileread, contents, %scriptfile%
formatted := FormatKeyList( contents )
file := scriptfile
}
return formatted
}
FormatKeyList( lines, srt = False ) {
; this does the actual formatting. Pass the text to be formatted
loop, parse, lines, `n, `r
if SubStr(A_LoopField, 1, 2) = ";;"
KeyList .= SubStr(A_LoopField, 3) "`n"
else if RegExMatch(A_LoopField, "^\s*(?<hk>[^:]+)::(?<cmd>.*?)(?:(?<=\s);;(?<desc>.*))?$", _)
KeyList .= HumanReadableHK( _hk ) "¬" (_desc ? _desc : _cmd) "¬" _hk "`n"
else if RegExMatch(A_LoopField, "^\s*:(?<opt>[^:]*):(?<hs>[^:]+)::(?<rep>.*?)(?:(?<=\s);;(?<desc>.*))?$", _)
KeyList .= _hs "¬" (_desc ? _desc : _rep) "¬" ":" _opt ":" _hs "`n"
if sort
sort, KeyList, P16 ; sort the comments
return KeyList
}
HumanReadableHK( key ) {
;a function to take care of replacing symbols in hotkeys with their words
StringReplace, key, key, +, Shift%A_Space%+%A_Space%
StringReplace, key, key, #, Win%A_Space%+%A_Space%
StringReplace, key, key, !, Alt%A_Space%+%A_Space%
StringReplace, key, key, ^, Ctrl%A_Space%+%A_Space%
StringReplace, key, key, &, %A_Space%and%A_Space%
StringReplace, key, key, $, hooked%A_Space%
return key
}