AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Display and Sort Hotkeys
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
JoeSchmoe as Guest
Guest





PostPosted: Tue Sep 23, 2008 2:16 pm    Post subject: Reply with quote

Thanks, hutch! Much appreciated!
Back to top
hutch@edge.net



Joined: 16 Sep 2008
Posts: 77

PostPosted: Wed Oct 08, 2008 6:41 pm    Post subject: Won't Compile Well Reply with quote

Greetings, Gurus.

Anybody know why the ^z menu won't show when I compile the script into an executable?

Any help would be appreciated.

Hutch
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Sat Oct 11, 2008 12:31 pm    Post subject: Final Customized Version Reply with quote

Hey all,

I have modified Hutch's script to fulfill my requirements and make it more complete i guess, as such i think everyone can safely add this script to their includes directory and use it easily now!
So this is the long awaited summary I've been waiting for, hehe Smile

Quote:

Features :
- display hotstrings (and expansion if no ;; comment), allows :*: hotstrings and other variations (i.e. Surprised: ...etc)
- display Hotkey (only if comment ;Wink
- ignore single comment lines
- include all other features from before (i.e. display hotstrings, hotkeys, ;; comments ...etc)
- standalone script can be included in file - see below

e.g. #include KeyList.AHK
#z:: ;;Show this list
KeyList(A_ScriptFullPath)
KeyWait, z
Progress, off
return



Save as KeyList.ahk
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
;#SingleInstance force

KeyList(scriptfile)
{
  AutoTrim,off
  Loop,Read,%scriptfile%
  {
    Line=%A_LoopReadLine%
; Only show lines that contain double semicolons
    IfInString,Line,`;`;
    {
      StringLeft,First2Chars,Line,2
      StringLeft,FirstChar,Line,1
; Insert blank or comment lines (start with double semicolon)
      IfEqual,First2Chars,`;`;
      {
        StringTrimLeft,Desc,Line,2
        KeyList=%KeyList%%Desc%`n
        Continue
      }
; Insert Hotkeys and Hotstrings (must contain double colon)
      IfInString,Line,`:`:
      {
; Extract description (after last semicolon)
        StringSplit,Desc,Line,`;`:
        StringTrimLeft,Desc,Desc%Desc0%,0
; If description is blank, use command or hotstring text instead
        If Desc=
        {
          EnvSub,Desc0,2
          StringTrimLeft,Desc,Desc%Desc0%,0
        }
; Extract keys
        StringSplit,Keys,Line,`:
; Hotstrings (start with double colon)
        IfEqual,First2Chars,`:`:
        {
          Keys=%Keys3%
          IfEqual,Desc,,SetEnv,Desc,%Keys5%
        }
; Hotstrings (start with single colon) - i.e. those hotstrings with options given. e.g. :c:tt::ta ta
        Else IfEqual,FirstChar,`:
        {
          Keys=%Keys3%
          IfEqual,Desc,,SetEnv,Desc,%Keys5%
          ;MsgBox, 1st char = %FirstChar% 2 chars = %First2Chars% split = %Keys% line = %line% ;DEBUG
        }       
; Hotkeys (start with anything else)
        Else
        {
          StringReplace,Keys,Keys1,#,Win- ;Why the Keys1 here instead of Keys?
          StringReplace,Keys,Keys,!,Alt-
          StringReplace,Keys,Keys,^,Ctrl-
          StringReplace,Keys,Keys,+,Shift-
          StringReplace,Keys,Keys,`;,
        }
; Add to the list
; Make keys 15 long with trailing spaces to keep the list neatly formatted

        Keys=%Keys%               !
        StringLeft,Keys,Keys,15
        Desc=%Keys% %Desc%
        KeyList=%KeyList%%Desc%`n
; Keep track of longest line to set window width later
        StringLen,Len,Desc
        If Len > %MaxLen%
          MaxLen = %Len%
      }
    }
  }
; Now show the list
  EnvMult,MaxLen,8.0 ; pixel width of 1 character
  EnvAdd,MaxLen,20 ; + 2 x 10 pixel margins
  StringTrimRight,KeyList,KeyList,1
;  Sort, KeyList, P16 ; sort the comments
  Progress, M2 C00 ZH0 FS10 W%MaxLen%,%KeyList%,,Hotkeys and Hotstrings list,courier new
  KeyList=
  MaxLen=
Return
}

;a function to take care of replacing symbols in shortcut keys with their words
HumanReadableShortcut(key)
{
  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,),String%A_Space%is%A_Space%
  Return %Key%
}

; FOR TESTING AS STANDALONE SCRIPT, if it is included in another script it will be safely ignored

; ;****************************************************
; ;Add Hotkeys and Hotstrings Below
; ;****************************************************
; ;;  HotKeys

; ^z::  ;;Show This List - use the following code in your function call for script
   KeyList(A_ScriptFullPath)
   Sleep 1000
   KeyWait, z
   Progress, off
 ExitApp

;add comments like these to your own script to make the
; output of this script easier to read
;;===Global Hotstrings===
::t1::tester! ;;
:c:t2::testmy! ;;
; ;****************************************************
; ;Add the List to the AHK Menu
; ;****************************************************
  ; Menu,Tray,Add,Hot&keys list,KeyList
  ; Menu,Tray,Default,Hot&keys list
; ;Run once
  ; KeyList(%A_ScriptFullPath%)
  ; KeyWait, z
  ; Progress, off


also hutch, it won't show when compiled, because when an exe, it can't read the source and show the summary! so you have to point it to the source file!!! that is if you want to use the feature in the executable Smile

i.e.
myscript.exe
myscript.ahk - must be in same dir as executable
or you could hardcode it in

code in myscript.ahk should be
Quote:

#z:: ;;Show this list
If A_IsCompiled
{
StringTrimRight, script, A_ScriptFullPath, 3
script = %script%ahk
}
Else
{
script = %A_ScriptFullPath%
}
KeyList(script)
Sleep 1000
KeyWait, z
Progress, off
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Sat Oct 11, 2008 5:50 pm    Post subject: list id briefly displayed then script exits Reply with quote

I was about try writing exactly such a script--I'm glad I found this thread. I'm having trouble integrating it though. I've added
Code:
#Include KeyList.ahk


#z:: ;;Show this list
KeyList(A_ScriptFullPath)
KeyWait, z
Progress, off
return

to the top of my main ahk script and created the KeyList.ahk file based on vixay's code. When I save and reload the script, the #z shortcut is displayed in a pop up window that disappears after a second, then the script also exits. I tried running the KeyList script directly: same result, though the demo hotkeys are displayed for that brief second. What am I missing here?

Thanks,
Mike
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Sat Oct 11, 2008 5:54 pm    Post subject: Reply with quote

Got it. In this section of the KeyList code:
Code:
; FOR TESTING AS STANDALONE SCRIPT, if it is included in another script it will be safely ignored

; ;****************************************************
; ;Add Hotkeys and Hotstrings Below
; ;****************************************************
; ;;  HotKeys

; ^z::  ;;Show This List - use the following code in your function call for script
   KeyList(A_ScriptFullPath)
   Sleep 2000
   KeyWait, z
   Progress, off
  ExitApp

I commented out the ExitApp line. Now the window pops up when I first run my main script, which isn't ideal, but otherwise seems to work correctly.
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Sat Oct 11, 2008 6:56 pm    Post subject: Reply with quote

OK, two other issues, which may be related to each other:
1. I'd prefer that the popup show until any key is pressed--I don't want to hold down the hotkey.

2. I'd like to reassign the hotkey to call KeyList to CapsLock & Space. Attempting to use CapsLock , either by itself or in combination with other keys, causes problems. The popup window appears but just as quickly disappears, "flickering" as long as the trigger is held down.

Thanks,
Mike
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Mon Oct 20, 2008 4:40 am    Post subject: Reply with quote

mkny wrote:
OK, two other issues, which may be related to each other:
1. I'd prefer that the popup show until any key is pressed--I don't want to hold down the hotkey.

2. I'd like to reassign the hotkey to call KeyList to CapsLock & Space. Attempting to use CapsLock , either by itself or in combination with other keys, causes problems. The popup window appears but just as quickly disappears, "flickering" as long as the trigger is held down.

Thanks,
Mike


1. See the thread some of the previous incarnations do that, you have to use another method, rather than a PROGRESS window...
you can also comment out the "Progress OFF" line to leave it up... play around

2. That is a known issue and quite complicated to fix. I suggest you research that.
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Mon Oct 20, 2008 8:57 pm    Post subject: Reply with quote

Thanks, I'll do some digging.

I resolved the CapsLock issue by applying another script form the forum that calls for a double tap of CapsLock to toggle it. Now it works fine as a modifier.
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Tue Dec 02, 2008 3:36 pm    Post subject: Reply with quote

Here another question for anyone: how would you edit AutoHotstring.ahk to append " ;;" to every hotstring it generates. I tried inserting that sequence into a couple of places in the script without success. I realize `; is the escape sequence, but how do you double them up? And where the best place to insert them?

Thanks.
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Thu Dec 04, 2008 4:35 am    Post subject: Reply with quote

mkny wrote:
Here another question for anyone: how would you edit AutoHotstring.ahk to append " ;;" to every hotstring it generates. I tried inserting that sequence into a couple of places in the script without success. I realize `; is the escape sequence, but how do you double them up? And where the best place to insert them?

Thanks.


Link to source?
`;`; should double it up.
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Mon Dec 08, 2008 8:32 pm    Post subject: Reply with quote

vixay wrote:
`;`; should double it up.

That works. For some stupid reason I had inserted a space between them. Thanks.
Back to top
View user's profile Send private message
sebastian



Joined: 06 Nov 2007
Posts: 26
Location: Sydney

PostPosted: Mon Jan 12, 2009 2:47 am    Post subject: Reply with quote

I've used a older/earlier version of this script for quite some time so foregive me my ignorance ... but how the heck am I suppose to use this script? Question Embarassed
maybe I'm just not seeing the instruction...

I placed the 'KeyList.ahk' in C:\Program Files\AutoHotkey\Lib

As a next step I assume I have to add something to the actual script I want to equip with the hotkey list.

all my hotkeys have comments similar to
Code:
; hotkey WIN + 2
#2:: ;;initialise results display to Default


will I need to change the syntax or write a list of the hotkeys?

I tried to make some sense out of the last 20 lines but ... well it's a Monday here...
Back to top
View user's profile Send private message
mkny



Joined: 28 Sep 2006
Posts: 43

PostPosted: Thu Jun 04, 2009 8:23 pm    Post subject: two column display Reply with 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
Back to top
View user's profile Send private message
Voltron43



Joined: 27 Mar 2009
Posts: 76
Location: Dublin, IE

PostPosted: Sun Jun 21, 2009 2:24 am    Post subject: Reply with quote

sebastian wrote:
...but how the heck am I suppose to use this script?

Just add ShowKeyList("[Hotkey]") function to your script. Also, you should rename "KeyList.ahk" to ShowKeyList.ahk

Code:
; hotkey WIN + 2
#2::ShowKeyList("2") ;;initialise results display to Default

_________________
My Scripts
Back to top
View user's profile Send private message Visit poster's website
Voltron43



Joined: 27 Mar 2009
Posts: 76
Location: Dublin, IE

PostPosted: Sun Jun 21, 2009 2:27 am    Post subject: Reply with quote

I've modified the progress bar to look similar to Google's Gmail/Reader hotkey list with a black background and yellow font.
Code:
...
;  Sort, KeyList, P16 ; sort the comments
  Progress,CWBlack R20-20 CTYellow B C00 ZH0 FS12 WS1000 W%MaxLen%,%KeyList%,,Hotkeys and Hotstrings list,courier new
  WinSet, Transparent, 200, Hotkeys and Hotstrings list
...

_________________
My Scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 4 of 6

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group