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 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Mon May 10, 2004 9:43 pm    Post subject: Display and Sort Hotkeys Reply with quote

script will copy all '::' lines to a new file, sort it and load it in notepad.

Anyone know a way to do this without using the xp sort command?

I'd like to elimate the dos box that briefly opens for the sort.



Code:


z & v::
filedelete  c:\test.txt
clipboard =
i = 0
pos = 0
Needle = `:`:
MsgBox, 0, , Processing Initiated , .9         ;msg to indicate processing
sleep 200

Loop
{
   i += 1
   FileReadLine, line, C:\My Documents\test.ahk, %i%
   if ErrorLevel <> 0
      break
   
   StringLeft, OutputVar, line, 1 
    If outputvar <> `;                        ;Is first char Not a comment (;)
       {
       StringGetPos, pos, line, %Needle%   
   
      if pos >= 1                           ;Does line contain ::
         {

         FileAppend, %line% `r`n, c:\Test.txt
         clipboard = %clipboard% `r`n  %line%    ;append to clipboard
         ;MsgBox, 0, , Line # %i% , .05         ;msg to indicate processing
         pos = 0
         }
      }
}
;Send, ^v

msgbox, 0, , End of Line    Tron, .9

run, sort /+1 c:\test.txt /O "c:\testsrt.txt"
sleep 900
run notepad "c:\testsrt.txt" {enter}
sleep 200
winmaximize ,  - Notepad

return
Back to top
View user's profile Send private message
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Mon May 10, 2004 9:49 pm    Post subject: Reply with quote

Here is the ouput

It would be more useful if I add more comment lines to the hotkeys

Code:

!^+f::
!q::
$^a::send ^a
$^c::                ;use $ if hotkey sends itself
$^v::
$a::send, a 
$q::send, q
$z::send z
^b::
^down::
^h::
^i::
^k::
^m::
^up::
^x:: 
^z::send, !eu      ; alt-e-u    undo
+q::                     ;select browser address field
+s::
+v::                           ;shift v = previous clipboard
+w::                         ; run google search
a & g::mouseclick, left, , , , ,
a & xbutton1::
a & xbutton1::
capslock & t::
capslock & y::
f13::
f14::
f15::
F24::               ;stroke it send F24
F7::                       ;  kensington driver locks on horiz scroll
mButton::
Numpadhome::send {right}
space & h::
space & t::
space & y::                   ; send keystrokes to background window!!
space::Send, {space}     ; non-repeating space
xbutton1::
xbutton2::
z & xbutton1::
z & xbutton1::
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon May 10, 2004 9:55 pm    Post subject: Reply with quote

In case you don't know, there's a menu option in each script's main window:

View >> Hotkeys

This will show you all the hotkeys defined by the script in the order that you defined them (which for some people is preferable to alphabetical order).
Back to top
View user's profile Send private message Send e-mail
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Mon May 10, 2004 10:04 pm    Post subject: Reply with quote

my idea is to show the hotkeys along with a ; comment of what they do.

of course i still have to add the ; comments!

Have I mentioned that Autohotkey is an excellent program!
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon May 10, 2004 10:06 pm    Post subject: Reply with quote

Oh, I understand now. I think I've forgotten some of my hotkeys too, so that's a good idea.
Back to top
View user's profile Send private message Send e-mail
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Mon May 10, 2004 11:44 pm    Post subject: Reply with quote

that's a good Idea, To stop the DOS box showing, try this-

Code:
run, sort /+1 c:\test.txt /O "c:\testsrt.txt",,Hide
Back to top
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue May 11, 2004 2:07 am    Post subject: Reply with quote

There's an item on the to-do list to sort the contents of a variable (perhaps based on a delimiter such as linefeed). One of these days...
Back to top
View user's profile Send private message Send e-mail
MikeG



Joined: 23 Apr 2004
Posts: 34
Location: Adelaide, South Australia

PostPosted: Tue May 18, 2004 5:08 am    Post subject: Here's my way... display all hotkeys in a MsgBox window Reply with quote

I've included this routine in my default hotkey script, at the request of my better half! I added a menu option to the tray menu and made it the default, so that double clicking the tray icon pops up the list of hotkeys. Not every hotkey is displayed, only those where a comment is delineated by a double semicolon ( ;; ). You can also add blank spacer lines with ;; on a line by itself. I have not bothered with sorting, they are just displayed as coded (good idea to have them sorted logically in the script anyway).

Code:

;*******************************************************************************
; Extract a list of hotkeys and their descriptions from this script
;*******************************************************************************
KeyList:
  SetBatchLines,-1
  AutoTrim,off
  Loop,Read,%A_ScriptName%
  {
    Line=%A_LoopReadLine%
    IfNotInString,Line,`;`;,Continue
    Key=
    IfInString,Line,`:`:
    {
      StringSplit,Key,Line,`:
      StringReplace,Key,Key1,#,Win-
      StringReplace,Key,Key,!,Alt-
      StringReplace,Key,Key,^,Ctrl-
      StringReplace,Key,Key,+,Shift-
      StringReplace,Key,Key,`;,
      Key=%key%               !
    }
    StringLeft,key,key,15
    StringSplit,Comment,Line,`;
    StringTrimLeft,Comment,Comment%Comment0%,0
    KeyList=%KeyList%%Key%`t%Comment%`n
  }
  MsgBox,0,Hotkeys list,%KeyList%
  KeyList=
Return


The bit that does the tray menu...
Code:

  Menu,Tray,Add,Hot&keys list,KeyList
  Menu,Tray,Default,Hot&keys list

[/code]

And a couple of hotkey definitions, note the ;; comment
Code:

#A::run c:\windows\dosprmpt.pif ;;DOS prompt
#B::run C:\Program Files\SecCopy\SecCopy.exe ;;Backup (Second Copy)
#C::run control.exe ;;Control Panel


The result is a message box that contains...

Win-A DOS Prompt
Win-B Backup
Win-C Control panel

I've used tabs to try to keep the columns aligned, although it may not *always* work Smile
Back to top
View user's profile Send private message AIM Address
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue May 18, 2004 12:40 pm    Post subject: Reply with quote

This hotkey reminder script is a nice extension, especially for those of us with dozens of hotkeys but who wind up forgetting half of them.
Back to top
View user's profile Send private message Send e-mail
Stefan
Guest





PostPosted: Mon Jul 26, 2004 9:34 pm    Post subject: Re: Here's my way... display all hotkeys in a MsgBox window Reply with quote

MikeG wrote:

Code:

;*******************************************************************************
; Extract a list of hotkeys and their descriptions from this script
;*******************************************************************************
KeyList:
  SetBatchLines,-1
  AutoTrim,off
  Loop,Read,%A_ScriptName%
  {
    Line=%A_LoopReadLine%
    IfNotInString,Line,`;`;,Continue
    Key=
    IfInString,Line,`:`:
    {
      StringSplit,Key,Line,`:
      StringReplace,Key,Key1,#,Win-
      StringReplace,Key,Key,!,Alt-
      StringReplace,Key,Key,^,Ctrl-
      StringReplace,Key,Key,+,Shift-
      StringReplace,Key,Key,`;,
      Key=%key%               !
    }
    StringLeft,key,key,15
    StringSplit,Comment,Line,`;
    StringTrimLeft,Comment,Comment%Comment0%,0
    KeyList=%KeyList%%Key%`t%Comment%`n
  }
  MsgBox,0,Hotkeys list,%KeyList%
  KeyList=
Return

Thanks for that very useful script.
Can you pls update it to show ::smtg:: hot keys too ?
I only see my ^!p:: hotkey, but not my ::#email:: hotkey.

MikeG wrote:


The bit that does the tray menu...
Code:

  Menu,Tray,Add,Hot&keys list,KeyList
  Menu,Tray,Default,Hot&keys list

[/code]


I don´t figure out how i can bring that to work.
I copy this code in the ini, i read the help, but i don´t find the right way.
I don´t see that new entry in tray menu.
Can somebody pls help me ?

Thanks
Stefan[/b]
Back to top
Guest






PostPosted: Fri Jul 30, 2004 5:30 am    Post subject: Update to include hotstrings too Reply with quote

Code:

;*******************************************************************************
; Extract a list of Hotstrings and Hotkeys from this script and display them
;*******************************************************************************
KeyList:
  AutoTrim,off
  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,15
      StringSplit,Desc,Line,`:
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`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,15
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`t%Desc%`n
    }
  }
  MsgBox,0,Hotkeys and Hotstrings list,%KeyList%
Return


I'm not sure why you can't get tray menu working. I have also linked this routine to a hotkey (#K). Hope this helps.
Back to top
MikeG



Joined: 23 Apr 2004
Posts: 34
Location: Adelaide, South Australia

PostPosted: Fri Jul 30, 2004 5:31 am    Post subject: oops... log in first! Reply with quote

Previous post was me Smile
Back to top
View user's profile Send private message AIM Address
Stefan
Guest





PostPosted: Fri Jul 30, 2004 3:36 pm    Post subject: Reply with quote

Hi MikeG
thanks very much for your help.

1.)
Thanks for improvment,
now i can see my ::Hotstrings:: too Very Happy




--------------------------------------------------------------

But there are some bugs in that script,
perhaps someone can sort them out ?


2.) if i use
Code:

::smtg:: ;; TestTest
send, Test string for testing issue

i get with #k a list with those entry twice times:
smtg ;; TestTest
smtg TestTest


2a)BTW, if i don´t use those ;;,
"TestTest" will be my sending keys bei writing "smtg "
instead of "Test string for testing issue"
But i think that can be a nice and handy feature Wink


3.) With every use of #k
the list in those popup message box
are there one time more:

First pressing #k
Win-z Homepage
Ctrl-Alt-n Notepad
Ctrl-Alt-p PSPad
smtg ;; TestTest
smtg TestTest


second pressing #k
Win-z Homepage
Ctrl-Alt-n Notepad
Ctrl-Alt-p PSPad
smtg ;; TestTest
smtg TestTest
Win-z Homepage
Ctrl-Alt-n Notepad
Ctrl-Alt-p PSPad
smtg ;; TestTest
smtg TestTest


and so on
till i reload the script

4.)
Code:

Menu,Tray,Add,Hot&keys list,KeyList
Menu,Tray,Default,Hot&keys list

i copied this only in Autohotkey.ini
and reload the ini
but i saw noting in tray menu ???
- must it be in a special section of the ini ?
- must there be a anything else around "Menu,Tray,.."

have a nice day
and thanks for helping
stefan
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Jul 30, 2004 6:43 pm    Post subject: Reply with quote

Quote:
- must it be in a special section of the ini ?

Although Menu commands can be used anywhere, they are most typically used in the auto-execute section (top part) of the script.
Back to top
View user's profile Send private message Send e-mail
Stefan



Joined: 30 Jul 2004
Posts: 72
Location: Deutschland (sorry for my english)

PostPosted: Sat Jul 31, 2004 12:15 am    Post subject: Reply with quote

puting it on top of ini works now, Very Happy
i saw the new entry in tray menu , thanks !


--------------------------------------------------------------------
sample ini:

...
; and it launches a new Notepad window (or activates an existing one). To
; try out these hotkeys, run AutoHotkey again, which will load this file.

Menu, Tray, Add, Hot&keys list, KeyList
Menu, Tray, Default, Hot&keys list
return


#z::Run, www.autohotkey.com ;;www.autohotkey.com

^!n:: ;;Notepad
IfWinExist, Unbenannt - Editor
...
_________________
Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
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