AutoHotkey Community

It is currently May 26th, 2012, 7:36 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 84 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Display and Sort Hotkeys
PostPosted: May 10th, 2004, 9:43 pm 
Offline

Joined: April 5th, 2004, 7:24 pm
Posts: 98
Location: Connecticut USA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2004, 9:49 pm 
Offline

Joined: April 5th, 2004, 7:24 pm
Posts: 98
Location: Connecticut USA
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::


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2004, 9:55 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2004, 10:04 pm 
Offline

Joined: April 5th, 2004, 7:24 pm
Posts: 98
Location: Connecticut USA
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2004, 10:06 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Oh, I understand now. I think I've forgotten some of my hotkeys too, so that's a good idea.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2004, 11:44 pm 
Offline

Joined: April 28th, 2004, 1:12 pm
Posts: 349
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2004, 2:07 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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...


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 18th, 2004, 5:08 am 
Offline

Joined: April 23rd, 2004, 4:38 am
Posts: 34
Location: Adelaide, South Australia
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 :-)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2004, 12:40 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 26th, 2004, 9:34 pm 
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]


Report this post
Top
  
Reply with quote  
PostPosted: July 30th, 2004, 5:30 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject: oops... log in first!
PostPosted: July 30th, 2004, 5:31 am 
Offline

Joined: April 23rd, 2004, 4:38 am
Posts: 34
Location: Adelaide, South Australia
Previous post was me :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 30th, 2004, 3:36 pm 
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
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 ;-)


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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 30th, 2004, 6:43 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 31st, 2004, 12:15 am 
Offline

Joined: July 30th, 2004, 11:30 pm
Posts: 74
Location: Deutschland (sorry for my english)
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
...

_________________
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”


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 1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, jrav, Xx7 and 11 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