Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Display and Sort Hotkeys


  • Please log in to reply
86 replies to this topic
jamestr
  • Members
  • 98 posts
  • Last active: Jul 03 2008 12:30 AM
  • Joined: 05 Apr 2004
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.




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


jamestr
  • Members
  • 98 posts
  • Last active: Jul 03 2008 12:30 AM
  • Joined: 05 Apr 2004
Here is the ouput

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

!^+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:: 


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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).

jamestr
  • Members
  • 98 posts
  • Last active: Jul 03 2008 12:30 AM
  • Joined: 05 Apr 2004
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!

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Oh, I understand now. I think I've forgotten some of my hotkeys too, so that's a good idea.

Jon
  • Members
  • 349 posts
  • Last active: Aug 30 2011 08:35 PM
  • Joined: 28 Apr 2004
that's a good Idea, To stop the DOS box showing, try this-

run, sort /+1 c:\test.txt /O "c:\testsrt.txt",,Hide


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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...

MikeG
  • Members
  • 34 posts
  • Last active: Jul 17 2011 05:13 AM
  • Joined: 23 Apr 2004
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).

;*******************************************************************************
; 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...
  Menu,Tray,Add,Hot&keys list,KeyList
  Menu,Tray,Default,Hot&keys list
[/code]

And a couple of hotkey definitions, note the ;; comment
#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 :-)

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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.

Stefan
  • Guests
  • Last active:
  • Joined: --

;*******************************************************************************
; 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.

The bit that does the tray menu...

  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]

  • Guests
  • Last active:
  • Joined: --
;*******************************************************************************
; 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.

MikeG
  • Members
  • 34 posts
  • Last active: Jul 17 2011 05:13 AM
  • Joined: 23 Apr 2004
Previous post was me :)

Stefan
  • Guests
  • Last active:
  • Joined: --
Hi MikeG
thanks very much for your help.

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




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

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


2.) if i use
::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 ;-)


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.)
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

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

- 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.

Stefan
  • Members
  • 74 posts
  • Last active: Apr 15 2009 09:33 PM
  • Joined: 30 Jul 2004
puting it on top of ini works now, :D
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
...
Posted Image Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”