AutoHotkey Community

It is currently May 26th, 2012, 9:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 84 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject:
PostPosted: July 10th, 2009, 4:29 pm 
Offline

Joined: September 28th, 2006, 5:33 pm
Posts: 58
BUMP:
Quote:
I've added so many hotkeys/strings that the popup window is getting chopped off by the bottom of my screen. Is it possible to make the popup split results into two columns (ideally hotkeys in one column, hotstrings in the other)? Thanks, Mike


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2009, 5:43 pm 
Offline

Joined: April 8th, 2008, 7:39 pm
Posts: 8
The Short-Cut list is shown now, when loading the script.
How can I avoid that? That only, if I click on the menu it is shown!?

And further on, how can I make the window close when pressing the "ESC"-Key?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2009, 1:02 pm 
Offline

Joined: September 28th, 2006, 5:33 pm
Posts: 58
BUMP
mkny wrote:
BUMP:
Quote:
I've added so many hotkeys/strings that the popup window is getting chopped off by the bottom of my screen. Is it possible to make the popup split results into two columns (ideally hotkeys in one column, hotstrings in the other)? Thanks, Mike


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 2:50 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
Here is a modified version that uses a sane parser that's a bit shorter and uses a modified version of the View() function posted by SKAN to display the result more reliably.

EDIT: Use the version in the next post instead of this one.

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 27 2009 at 08:30:PM
;#SingleInstance force

ViewKeyList( A_ScriptFullPath )

ViewKeyList( scriptfile ) {
   View(FormatKeyListFile( scriptfile ), "Title=Key List" )
}

FormatKeyListFile( scriptfile ) {
; this function reads scriptfile and returns a formatted string from FormatKeyList
   fileread, contents, %scriptfile%
   return FormatKeyList( contents )
}

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) "`n"
      else if RegExMatch(A_LoopField, "^\s*:(?<opt>[^:]*):(?<hs>[^:]+)::(?<rep>.*?)(?:(?<=\s);;(?<desc>.*))?$", _)
         KeyList .= _hs " = " (_desc ? _desc : _rep) "`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
}

View( Text, Options="" ) {
; option=default
;     W=640, H=480, X=[centered], Y=[centered]
;     Title=A_ScriptFullPath, Wrap=False, ReadOnly=True
;     Font=Courier New, FHt, FWt
   ReadOnly := true, Title := A_ScriptFullPath
   loop, Parse, Options,`,=, %A_Space%
      A_Index & 1  ? ( Var := A_LoopField ) : ( %Var% := A_LoopField )
     W:=W ? W:640
   , H:=H ? H:480
   , X:=X!="" ? X:((A_ScreenWidth/2)-(W/2))
   , Y:=Y!="" ? Y:((A_ScreenHeight/2)-(H/2))
   , WS:=Wrap ? 0x50201044:0x503010C4
   , WS|=ReadOnly ? 0x800:0
   , Text := RegExReplace(Text, "(?<!\r)\n", "`r$0")
   hWnd := DllCall( "CreateWindowEx",Int,0, Str,"#32770", Str, Title, UInt, 0x10400000
      , UInt,X, UInt,Y, UInt,W, UInt,H, Int,0,Int,0,Int,0,Int,0,Int,0 )
   VarSetCapacity( CR,16,0 ),  DllCall( "GetClientRect", UInt, hWnd, UInt,&CR )
   Edit := DllCall( "CreateWindowEx", Int, 0, Str, "Edit", Int, 0, UInt, WS, Int, 0,Int,0, UInt
      ,NumGet(CR,8), UInt, NumGet(CR,12), UInt,hWnd, Int,0,Int,0,Int,0 )
   hFnt := DllCall( "CreateFont", Int,FHT ? FHt:0, Int,0,Int,0,Int,0, Int,( FWt="Bold")? 700
      :0, Int,0,Int,0,Int,0,Int,0,Int,0,Int,0,Int,0,Int,0, Str,Font ? Font:"Courier New" )
   DllCall( "SendMessageA", UInt, Edit, UInt,0x30, UInt,hFnt, UInt,0 )       ; WM_SETFONT
   DllCall( "SendMessageA", UInt, Edit, UInt,0xD3, UInt,1   , UInt,5 )       ; EM_SETMARGINS
   DllCall( "SendMessageA", UInt, Edit, UInt,0x0C, UInt,0   , UInt,&Text )   ; WM_SETTEXT
   DllCall( "SendMessageA", UInt, Edit, UInt,0xB1, UInt,-1  , UInt,0 )       ; EM_SETSEL
   WinActivate, ahk_id %hwnd%
   KeyWait, Esc, L
   KeyWait, Esc, D L
   DllCall( "DestroyWindow", UInt, hWnd ), DllCall( "DeleteObject", UInt, hFnt )
}

;FOR TESTING AS STANDALONE SCRIPT, if it is included in another script it will be safely ignored
/* (comment these block comment lines out to test with Ctrl+z)

;;===HotKeys===
^z::  ;;Show This List - use the following code as examples for your script
   ViewKeyList(A_ScriptFullPath)
ExitApp

a & $`;::
   MsgBox test
exitapp

;add comments like these to your own script to make the output of this script easier to read
;;
;;===Hotstrings===
::t1::tester! ;;description. the next one uses the replacement text itself as the description
:c:t2::testmy! ;;

*/

_________________
Scripts - License


Last edited by infogulch on September 22nd, 2009, 9:12 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 9:11 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
I changed it again.

It now uses a modified-modified-version of View() ( durr :roll: )

It now caches the last formatted hotkey file so it doesn't have to re-read and re-parse it every time.
I added a ViewKeyListFromHK() function to be used from a hotkey to temporairly display the view until the hotkey is released.
I added the StripHKModifiers() function from another topic (link in code) that's used in the ViewKeyListFromHK() function.

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
;#SingleInstance force

ViewKeyListFromHK( scriptfile ) {
   View(FormatKeyListFile( scriptfile ), "Title=Key List, Key=" StripHKModifiers() ", KeyDir=" ErrorLevel )
}

ViewKeyList( scriptfile ) {
   View(FormatKeyListFile( scriptfile ), "Title=Key List (Esc to exit)" )
}

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) "`n"
      else if RegExMatch(A_LoopField, "^\s*:(?<opt>[^:]*):(?<hs>[^:]+)::(?<rep>.*?)(?:(?<=\s);;(?<desc>.*))?$", _)
         KeyList .= _hs " = " (_desc ? _desc : _rep) "`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
}

/* Function View( Text="""", Options="""" ) by SKAN. (Slightly modified by infogulch)

returns the milliseconds the view was shown
sets errorlevel to 1 if the timout was reached
sets errorlevel to 0 if the hotkey state was reached first

Text: The text to be displayed
Options: space and comma separated string of options (format: option=default)
    Window W=640, H=480, X=[centered], Y=[centered]
    Title=A_ScriptFullPath, Wrap=False, ReadOnly=True
    Font=Courier New, FHt, FWt
    Key=Esc, KeyDir=Down
    Timeout=0 (0 means no timeout)
*/

View( Text= "", Options= "" ) {
; http://www.autohotkey.com/forum/viewtopic.php?p=298037#298037
   ReadOnly := True, Title := A_ScriptFullPath, Key := "Esc", KeyDir := "Down"
   loop, Parse, Options,`,=, %A_Space%%A_Tab%`r`n
      A_Index & 1  ? ( Var := A_LoopField ) : ( %Var% := A_LoopField )
   W:=W ? W:640
   , H:=H ? H:480
   , X:=X+0!="" ? X:((A_ScreenWidth/2)-(W/2))
   , Y:=Y+0!="" ? Y:((A_ScreenHeight/2)-(H/2))
   , WS:=Wrap ? 0x50201044:0x503010C4
   , WS|=ReadOnly ? 0x800:0
   , Text := RegExReplace(Text, "(?<!\r)\n", "`r$0")
   , KeyDir := KeyDir = "down" || KeyDir = "d" ? "D" : ""
   , Timeout := Timeout+0 ? "T" Timeout : ""
   hWnd := DllCall( "CreateWindowEx",Int,0, Str,"#32770", Str, Title, UInt, 0x10400000
      , UInt,X, UInt,Y, UInt,W, UInt,H, Int,0,Int,0,Int,0,Int,0,Int,0 )
   VarSetCapacity( CR,16,0 ),  DllCall( "GetClientRect", UInt, hWnd, UInt,&CR )
   Edit := DllCall( "CreateWindowEx", Int, 0, Str, "Edit", Int, 0, UInt, WS, Int, 0,Int,0, UInt
      ,NumGet(CR,8), UInt, NumGet(CR,12), UInt,hWnd, Int,0,Int,0,Int,0 )
   hFnt := DllCall( "CreateFont", Int,FHT ? FHt:0, Int,0,Int,0,Int,0, Int,( FWt="Bold")? 700
      :0, Int,0,Int,0,Int,0,Int,0,Int,0,Int,0,Int,0,Int,0, Str,Font ? Font:"Courier New" )
   DllCall( "SendMessageA", UInt, Edit, UInt,0x30, UInt,hFnt, UInt,0 )       ; WM_SETFONT
   DllCall( "SendMessageA", UInt, Edit, UInt,0xD3, UInt,1   , UInt,5 )       ; EM_SETMARGINS
   DllCall( "SendMessageA", UInt, Edit, UInt,0x0C, UInt,0   , UInt,&Text )   ; WM_SETTEXT
   DllCall( "SendMessageA", UInt, Edit, UInt,0xB1, UInt,-1  , UInt,0 )       ; EM_SETSEL
   Start := A_TickCount
   WinActivate, ahk_id %hwnd%
   KeyWait, %Key%, %KeyDir% %Timeout%
   err := ErrorLevel, DllCall( "DestroyWindow", UInt, hWnd ), DllCall( "DeleteObject", UInt, hFnt )
   return A_TickCount - Start, ErrorLevel := err
}


StripHKModifiers( x = "" ) {
; http://www.autohotkey.com/forum/viewtopic.php?p=298035#298035
   RegEx := RegExMatch( x ? x : A_ThisHotkey, "i)(?:[~#!<>\*\+\^\$]*([^ ]+)( UP)?)$", Key)
   return Key1, ErrorLevel := (Key2 ? "Down" : "Up")
}

;FOR TESTING AS STANDALONE SCRIPT, if it is included in another script it will be safely ignored
/* (comment these block comment lines out to test with Ctrl+z)

;;===HotKeys===
CapsLock & z::ViewKeyListFromHK( A_ScriptFullPath ) ;; View this list

a::a

a & $`;::
   MsgBox test
exitapp

;add comments like these to your own script to make the output of this script easier to read
;;
;;===Hotstrings===
::t1::tester! ;;description. the next one uses the replacement text itself as the description
:c:t2::testmy! ;;

*/

_________________
Scripts - License


Last edited by infogulch on September 20th, 2010, 10:35 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 3rd, 2009, 5:36 pm 
Offline

Joined: October 3rd, 2009, 5:32 pm
Posts: 1
Excellent stuff!

Would it be possible to take this a step further and produce an ahk app which can display all the hotkeys in a particular file as well as adding/editing them?

I was thinking of a GUI similar to the Scriplet Library, only it reads and edits your hotkeys within a script, rather than scriptlets within an ini file?

Something like this:

Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 7th, 2009, 1:34 am 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
It's been a long time since I looked at this thread. I have been using MikeG's version for a long time, and just modified it to use a listview because I have too many hotkeys for one screen using a msgbox. I thought I'd post that little mod. I'm afraid I'm not going to closely examine all the changes and improvements o the last couple years right now. Just show my minor mod to MikeG's version and get out of here. I decided to put them in something I could scroll is all. Like the original by MikeG, you put a double semicolon after every hotkey and then any comment you want in the (now) listview. Oh, and the hotkey toggles the listview alswaysontop and/or minimizes it.

-- CutnPaste Kid

Code:
^#k::  ;;List of Hotkeys
IfWinExist,AHK-Help
   {
   If Chips <> 1
   {
   WinSet,AlwaysOnTop,On,AHK-Help
   WinRestore,AHK-Help
   Chips = 1
   }
   Else
   {
   Winset,AlwaysOnTop,Off,AHK-Help
   WinMinimize,AHK-Help
   Chips = 0
   }
   Return
   }
   Else
KeyList:
KeyList=
AutoTrim,off
Gui, Add, ListView, xm r20 w200 Grid VMyListView, Name | Text ; r20 w150
  Loop,Read,%A_ScriptFullPath%
  {
    Line=%A_LoopReadLine%
    StringLeft,C2,Line,2
; Insert blank lines
    IfEqual,C2,`;`;
    KeyList=%KeyList%`n
; Insert Hotstrings
    IfEqual,C2,`:`:
    {
      StringTrimLeft,Line,Line,2
      StringSplit,Keys,Line,`:
      Keys=%Keys1%               !
      StringLeft,Keys,Keys,20
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`t`t%Desc%`n
    }
; Insert Hotkeys with ;;comments
    IfInString,Line,`;`;,IfInString,Line,`:`:
    {
      StringSplit,Keys,Line,`:
      StringReplace,Keys,Keys1,#,Win-
      StringReplace,Keys,Keys,!,Alt-
      StringReplace,Keys,Keys,^,Ctrl-
      StringReplace,Keys,Keys,+,Shift-
      StringReplace,Keys,Keys,`;,
      Keys=%Keys%               !
      StringLeft,Keys,Keys,20
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
    ;Adding a listview 
   LV_ModifyCol()  ; Auto-size each column to fit its contents.
         LV_Add("",Keys,Desc)
      LV_ModifyCol()  ; Auto-size each column to fit its contents.
      LV_ModifyCol(3, 60) ; Make the Size column at little wider to reveal its header.
   ;GuiControl, +Redraw, MyListView  ; Re-enable redrawing (it was disabled above).
   }
         
   ; performs alphabetical sort:
   LV_ModifyCol(1, "Sort", Name)
   }
   Gui, +Resize
   Gui, Show,,AHK-Help
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



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2010, 8:31 pm 
ribbet.1 wrote:
It's been a long time since I looked at this thread. I have been using MikeG's version for a long time, and just modified it to use a listview because I have too many hotkeys for one screen using a msgbox. I thought I'd post that little mod. I'm afraid I'm not going to closely examine all the changes and improvements o the last couple years right now. Just show my minor mod to MikeG's version and get out of here. I decided to put them in something I could scroll is all. Like the original by MikeG, you put a double semicolon after every hotkey and then any comment you want in the (now) listview. Oh, and the hotkey toggles the listview alswaysontop and/or minimizes it.

-- CutnPaste Kid


Hi ribbet.1
I do like th list grid view the best. I do however want to combine it with :R: version of the hotkey since it's so specific. I did try to put another ifEqual and now the list is out of order.

What would you suggest? How do I simply take the "R" out of the :R: so that it acts like all the others ::st::somthing?

Thanks,
R


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2010, 10:34 pm 
Offline

Joined: April 20th, 2006, 9:54 pm
Posts: 21
I also liked the listview best so I took Infogulch's version and added the listview with some extended functionality.

You can sort the listview with ctrl-1 on column 1 or ctrl-2 on column 2.
And you can scroll to a hotkey and activate it with enter or dblclick. (This does not work for all hotstrings).

I decided not to rewrite the FormatKeyList function so I split the hotkey and description on an extended ascii character. Not sure if that works for everybody.

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
}



Report this post
Top
 Profile  
Reply with quote  
 Post subject: Found the Answer
PostPosted: March 30th, 2010, 10:59 pm 
This is it, this is what I have been looking for. :P

http://www.autohotkey.com/forum/topic17678.html


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2010, 8:04 am 
Offline

Joined: June 14th, 2009, 7:48 pm
Posts: 331
How to use it ?
I added it in an existing script added a hotkey above the code and fired it but only the empty list showed up.
What have I done wrong ?
I'd love to have this working...
:oops:
bold wrote:
I also liked the listview best so I took Infogulch's version and added the listview with some extended functionality.

You can sort the listview with ctrl-1 on column 1 or ctrl-2 on column 2.
And you can scroll to a hotkey and activate it with enter or dblclick. (This does not work for all hotstrings).

I decided not to rewrite the FormatKeyList function so I split the hotkey and description on an extended ascii character. Not sure if that works for everybody.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 30th, 2010, 8:09 pm 
Stephan:

I found out how to make it so the list doesn't repeat itself. At the end of your script, right before "return" you can put the variable then equals, which clears out the saved variable (In this case, KeyList) so your script should look like this at the end:

}
}
MsgBox,0,Hotkeys and Hotstrings list,%KeyList%
KeyList=
Return

Any questions, please let me know. Email is (apologies for how I have to put it) gmeforfree (at symbol ) gmail (dot or period) com


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 21st, 2010, 4:17 pm 
Offline

Joined: February 14th, 2006, 6:00 pm
Posts: 40
which return do you mean?

(I also have an empty list)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Further thoughts
PostPosted: July 29th, 2010, 1:27 pm 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
to use the new scripts by boush and infogulch you have to add the following to your script, assuming your file is called Keylist2.ahk

Code:
#Include, KeyList2.ahk
#z::    ;;Show this list
  ViewKeyListFromHK(A_ScriptFullPath)


You can also use the newer (1.0.47+) method of including library files, read http://www.autohotkey.com/docs/Functions.htm#lib

a few comments on the newest files ->
it doesn't ignore commented lines i.e.
Quote:
;asdfadsf ;;don't show this

a quickfix for this in FormatKeyList is
Code:
      if SubStr(A_LoopField, 1, 2) = ";;"
         KeyList .= SubStr(A_LoopField, 3) "`n"
      else if SubStr(A_LoopField, 1, 1) = ";"
         pass = pass


there is a typo in function FormatKeyList
Code:
   if sort
      sort, KeyList, P16 ; sort the comments
it should be
Code:
   if srt
      sort, KeyList, P16 ; sort the comments


unless the authors designed it to always sort

the infogulch version should vertically maximize the list or fit to content as the default view is tiny for large scripts.
(the forum doesn't make it easy to post images otherwise i'd post a few)

I also think the instructions on how to use the file should be in the header as can be seen by the questions from various people on how to use it.

/edit: added fix for ignoring commented lines


Last edited by vixay on July 29th, 2010, 2:04 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 1:59 pm 
Offline

Joined: February 14th, 2006, 6:00 pm
Posts: 40
Vixay,

I added

Code:
#Include, KeyList2.ahk
#z::    ;;Show this list
  ViewKeyListFromHK(A_ScriptFullPath)


to my ahk file and
created a new script KeyList2.ahk with the code written in Bold's message above.

Still an empty list. No hotkeys inside.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 84 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group