Hotkey Help - Display Active AHK Hotkeys and Hotstrings

Post your working scripts, libraries and tools
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

FIND BOX issues

11 Nov 2018, 16:14

Let me begin by saying your new FIND function is awesome. Your code is to be admired. I also think your script should be showcased.

I do, however, have a few problems/issues/suggestions as per the FIND function. And, yes, I realize it is new, so you may have already considered some of things I have to say.

1. After I close the Hotkey_help gui (not minimize it, not close the script), if I have used your new FIND function, the FIND GUI does not get closed. (Should the FIND gui be a child of the main gui?)

2. If I activate another window and then activate the Hotkey_help gui--for example, clicking the taskbar button--the FIND gui remains but is buried. Again, would it being a child gui help here?

3. I'm not fond of the initial positiion of the FIND gui. But, I realize it is moveable. What would be really nice is that if I move it, the .INI file remembers to where I have moved it. This may be trivial. Now that I've started playing around with your script, I'm used to where the Find gui where it is. At first, however, I never even noticed it appearing.

4. The EDIT control. The way you have designed the EDIT gui, when it appears there is not BLINKING CARET in the edit field. I must say I found the "GuiControl, Move, FindText_Var, h20 " command rather interesting. Why doesn't GUI ADD EDIT simply respect a H20 option? Yes, rhetorical question. But, why is this "quirk?" not documented? again, rhetorical question. It's all so complicated. I tried half a dozen ways to change your edit field. some worked. some didn't. But, in the long run, I find that NOT HAVING a CARET blinking is not desirable.

5. GUI Border - I absolutely despise windows with no borders. I will go to my grave running Windows 7 if I can. I guess if I go to hell I will be given Windows 10. I think the +0x800000 (thin border) option for the Edit gui would be much nice. But, personally, I find even that border too feeble. I much prefer the sizing border, +0x40000, even though I don't want to resize the window. I just like it popping to my eyes! How do people work without the border, especially when it indicates which window is the active window? If anyone knows of how to implement the sizing border while disabling sizing, I'd love to know.

6. It's absolutely great the way your script remembers the EDIT field. Windows and firefox can't seem to manage that when they should.

7. I had to increase the FONT for the FIND gui. Maybe that should be an .INI option. Windows system default font is just too small.

thanks (especially if got to here reading all my stuff!)
FanaticGuru
Posts: 1272
Joined: 30 Sep 2013, 22:25

Re: FIND BOX issues

12 Nov 2018, 12:38

joefiesta wrote:
11 Nov 2018, 16:14
Let me begin by saying your new FIND function is awesome. Your code is to be admired. I also think your script should be showcased.

I do, however, have a few problems/issues/suggestions as per the FIND function. And, yes, I realize it is new, so you may have already considered some of things I have to say.

1. After I close the Hotkey_help gui (not minimize it, not close the script), if I have used your new FIND function, the FIND GUI does not get closed. (Should the FIND gui be a child of the main gui?)

2. If I activate another window and then activate the Hotkey_help gui--for example, clicking the taskbar button--the FIND gui remains but is buried. Again, would it being a child gui help here?

3. I'm not fond of the initial positiion of the FIND gui. But, I realize it is moveable. What would be really nice is that if I move it, the .INI file remembers to where I have moved it. This may be trivial. Now that I've started playing around with your script, I'm used to where the Find gui where it is. At first, however, I never even noticed it appearing.

4. The EDIT control. The way you have designed the EDIT gui, when it appears there is not BLINKING CARET in the edit field. I must say I found the "GuiControl, Move, FindText_Var, h20 " command rather interesting. Why doesn't GUI ADD EDIT simply respect a H20 option? Yes, rhetorical question. But, why is this "quirk?" not documented? again, rhetorical question. It's all so complicated. I tried half a dozen ways to change your edit field. some worked. some didn't. But, in the long run, I find that NOT HAVING a CARET blinking is not desirable.

5. GUI Border - I absolutely despise windows with no borders. I will go to my grave running Windows 7 if I can. I guess if I go to hell I will be given Windows 10. I think the +0x800000 (thin border) option for the Edit gui would be much nice. But, personally, I find even that border too feeble. I much prefer the sizing border, +0x40000, even though I don't want to resize the window. I just like it popping to my eyes! How do people work without the border, especially when it indicates which window is the active window? If anyone knows of how to implement the sizing border while disabling sizing, I'd love to know.

6. It's absolutely great the way your script remembers the EDIT field. Windows and firefox can't seem to manage that when they should.

7. I had to increase the FONT for the FIND gui. Maybe that should be an .INI option. Windows system default font is just too small.

thanks (especially if got to here reading all my stuff!)
I appreciate the feedback.

Right now the Find command is basically just working. I will see what I can do to make it more user-friendly and configurable.

Making the Find dialog a child window does a lot of good things but the limitation is that the child window has to be inside the boundary of the parent window. If it is inside the Help window it risk being over the top of something being searched for. It still might be the way to go. Making a window dock to another window in a robust way is fairly complex. Right now I am just positioning it in relation to the main window but after that not having all the code required to have it react to changes to the main window. The Find dialog already looks for space to place in four locations. Could easily allow the user to set the default for which of those four to try first.

As for the BLINKING CARET, mine does blink when I bring up the find dialog. It blinks 5 times then goes solid. I assume this is some Windows setting. On a side note my caret for this forum post blinks 10 times then goes solid. I am not sure exactly what controls the Caret blinking.

The edit field is a little complicated.

Code: Select all

Gui Add, Edit, x10 y3 w200 r2 gFindText_Sub vFindText_Var -VScroll
GuiControl, Move, FindText_Var, h20
To have an edit control accept {Enter} or newline it must be multi-line. That is what the r2 does, makes it 2 rows. Then right below that the height of the edit control is adjusted to hide the second line. It is a technique for getting an edit control to respond by hitting enter with out having an "Ok" button or something like that. FindText_Sub: is actually called every time anything is typed in the control but unless the character is an "`n" nothing is done.

I will see about adding some style and font choices to the SearchEdit class.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
FanaticGuru
Posts: 1272
Joined: 30 Sep 2013, 22:25

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

21 Nov 2018, 17:54

Updated in First Post

Change Log: Update 2018 11 21
Improved Find command location.
Can dock and undock with the location being remembered. Will also save location between sessions if option turned on through the settings.

Making the Find dialog a child window of the Help dialog had a lot of limitations so the script handles most of the positioning, minimizing, maximizing, restoring, snapping, moving, etc. It is pretty cool and gives a pretty nice effect when the Find dialog is docked outside and the window is moved so that it no longer has room, it will dynamically move to a different location. This is not the behavior if you manually undock it. Then it just moves with the Window and could be off screen as it stays a fixed distance from the top left corner of the Help dialog.

It uses WM_WINDOWPOSCHANGED which took me a bit to unravel as it uses a WindowPos structure that took some trial-and-error to get the X,Y,W,H and Flags out of the structure. I never did figure out the flag bits properly so just used the overall flag numbers that I saw when Minimizing and Restoring in various ways.

Just for others that might Google this: X := NumGet(lParam+0, A_PtrSize + A_PtrSize, "int") without that +0 after the lParam, it would not work. I tried a lot of different things, offsets, data types, '&' pointers, etc. before I figured that out.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Error: does not handle SCnnn hotkeys

19 Dec 2018, 17:00

I have found an error in your script.

It does not display hotkeys in the format: <modifier(s)>SCnnn::
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Using Hotkey_help

20 Dec 2018, 12:23

I would like to make a few more suggestions about your script.

1. I would like the documentation for the script to be in the script itself.

a. Is there any other logical place to put documentation?
I can always find it if it is in the script. It is very annoying and extremely time-consuming to look for it online--especially when I can't be sure where it is EXACTLY.

b. Having the documentation in the AHK forum is very problematic.

1) I CAN NOT SEARCH FOR IT. The STUPID--as most search engines are--search engine does not search for "hotkey_help" when I enter it.

2) For that reason--and probably that reason only--I would like to suggest you change it's name to "HotkeyHelp".

c. GITHUB, if you're there, also would not be good, IMHO. Why should I have to go online to find the doc? And finding it on GITHUB would take much time. And, how many casual ahk users even know about github?

2. The .INI file name is problematic. I can not find it easily, because it is not simply the script name with filetype ".INI". This is not logical.

3. I have zillions of hotkeys. Yes, far too many and I can't remember half of them. Which is why I like your script so much. (I had written my own, but I never got around to putting a search function in it.) It would VERY NICE if the systray menu included a function to OPEN the Help screen. (I can't even remember WIN+F1 is for hotkeyhelp. Well.... I shouldn't HAVE TO!)
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

20 Dec 2018, 12:48

the .INI file does not respect the following entry:

Set_SortInfo=0

when I put in the .ini file, the hotkeys are still sorted. I can not have them sorted. They are arrange dvery logically and in my main script i have dozens if not hundreds of hotkeys.

By sorting them, their relationship is lost. Specifically, all those relating to a specific "*IFWINACTIVE ..." statement are no longer together.

What is REALLY needed is to preserve all the "*IFWINACTIVE..." statements in include them, probably surround by something to highlight them, in the display. For example, in my multi.ahk script, i have 12 F1 hotkeys defined, each relating to a different active program window.
FanaticGuru
Posts: 1272
Joined: 30 Sep 2013, 22:25

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

20 Dec 2018, 14:19

joefiesta wrote:
20 Dec 2018, 12:48
the .INI file does not respect the following entry:

Set_SortInfo=0

when I put in the .ini file, the hotkeys are still sorted. I can not have them sorted. They are arrange dvery logically and in my main script i have dozens if not hundreds of hotkeys.

By sorting them, their relationship is lost. Specifically, all those relating to a specific "*IFWINACTIVE ..." statement are no longer together.

What is REALLY needed is to preserve all the "*IFWINACTIVE..." statements in include them, probably surround by something to highlight them, in the display. For example, in my multi.ahk script, i have 12 F1 hotkeys defined, each relating to a different active program window.
I appreciate your feedback.

I can probably do something about including some 'help' in the script. And maybe include a customized tray icon dialog instead of just the generic AHK script options. On my system though I use "AHK Startup" script that bundles most of my AHK scripts into one tray icon so I do not even have an individual tray icon for "Hotkey Help".

The ini file should definitely perserve settings when set to use an ini file. It it does not then I will take a look at it but on my system the ini file is named 'Hotkey Help.ini'. If that is not the file you are modifing then that could be the problem. You should not really need to modify the ini directly. You should hit "Win+Alt+F1" to bring up the settings dialog where you can modify the settings as you like and then it will save them to an ini file assuming you have it set in the settings to use an ini file. You could just change the defaults in the actual script file but that is not the preferred method although it is an option for those who want to keep everything in one file with no ini.

As for the IFWINACTIVE, I thought about this but it is very difficult to accurately unravel the information of when a hotkey is active and when it is not. The way I handle this is in the creation of my comment on the line with the hotkey. I include in the comment when the hotkey is active so that information ends up in the Hotkey Help dialog.

Here is an example of my dialog for one of my scripts:

Code: Select all

================================ SHORTCUTS =================================
Win+Alt+S Up            <-- (Adobe Acrobat) : PDF Secure
Win+Ctrl+S Up           <-- (Adobe Acrobat) : PDF Unsecure
Win+V                   <-- (Adobe Acrobat) : Set Properties (Page Only, Single Page, Fit Page)
F12                     <-- (Excel) : Fill Active Cell - *No Fill*
F8                      <-- (Excel) : Fill Active Cell - Cycle Standard Colors
Ctrl+F9                 <-- (Excel) : Fill Active Cell - Dark Red
Ctrl+F11                <-- (Excel) : Fill Active Cell - Green
F11                     <-- (Excel) : Fill Active Cell - Light Green
Ctrl+F10                <-- (Excel) : Fill Active Cell - Orange
F9                      <-- (Excel) : Fill Active Cell - Red
F10                     <-- (Excel) : Fill Active Cell - Yellow
Ctrl+F12                <-- (Excel) : Hide Columns
Alt+F12                 <-- (Excel) : Hide Rows
Shift+F12               <-- (Excel) : Unhide Range / All
Shift+Tab               <-- (OneNote) : Insert Tab with /t
Win+J                   <-- (Outlook) : Junk / Block Sender
Win+Ctrl+E              <-- File Explorer : Open @ Documents
Win+Ctrl+Alt+E          <-- File Explorer : Open @ Pictures
Win+T                   <-- Outlook : New Task
Win+Ctrl+T              <-- Outlook : Open Tasks
I put in the comment for the hotkey the name of the application that the hotkey acts on and then if the name is in () that means the application has to be active. Basically I handle all this type information in the comment. This is for a script called "Shortcuts" that acts on several different applications.

Here is the comments in the "Hotkey Help" script itself:

Code: Select all

=============================== HOTKEY HELP ================================
Win+F1                  <--  ~ Display Help ~
Ctrl+F                  <-- (Hotkey Help) : Find
Win+Ctrl+F1             <-- Excluded Files, Hotkeys, and Hotstrings
Win+Alt+Ctrl+F1         <-- Raw Hotkey List
Win+Alt+F1              <-- Settings
The 'Find' command has "(Hotkey Help)" meaning that it only fires when "Hotkey Help" is active. I also used a sorting trick of putting ~ ~ around 'Display Help' to make it stand out and be sorted to the top. Basically what I am getting at is that a lot can be accomplished with organizing by creative construction of your comments on the hotkey lines.

This code and all its options has grown pretty complex over the years and I can definitely see how some better documentation is needed. I much prefer coding than writing documentation but I will see what I can do on that front. Reading through this whole thread is not really a great way to find out about all the features of this script that have been added over the years.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

21 Dec 2018, 09:52

Sorting.

I did not know about Win+ALT+f1 to bring up the options menu. I had mentioned that putting "Set_SortInfo=0" in the .INI file does not eliminate the sort. (And, yes, I know all about using the .INI file, what it is where, and it's fileid, etc. etc.)

But, when I open the options menu, the SORT option is confusing. It says: "Sort by hotkey description (otherwise by Hotkey Name)". Okay, it is not confusing. I don't get the logic. Or, put it this way: there should be 3 choices: (1) sort by hotkey description (2) sort by hotkey name (3) do no SORT at all.

By just looking at the .INI file entries, it is not clear that you always sort one way or the other. I want NO SORT and believe the most logical .INI file values should be 0 (NO sort), 1 (sort by hotkey name) and 2 (sort by hotkey comments). (I believe "comments" is technically more accurate. It is a COMMENT statement.)
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

21 Dec 2018, 11:06

FYI: I am revising my version to change the SORT methodology. It will include all the above suggestions. I will send you a copy when I am finished--which should be today!!

I do not want to maintain my own version of your script. That is SO MUCH a nuisance. I am hoping you like my changes. I will mark each changed/added/removed/ line with a comment, e.g. /* JSP 20181221 */.

I have noticed during testing a few other VERY MINOR issues. (1) When a RELOAD is done, the .INI file is not re-written. I am going to include doing that. (now that I look, this may be my fault, since this should not be necesary. I think my problem is quitting the options menu with ALt+f4.)
(2) When a change is done to the sort settings, ideally the change will be made to the active display. I am NOT including that, unless I find it trivial.

I hope you like and incorporate my changes. I have made great effort to imitate and preserve your style. However, I do find that you should have more subroutines (as opposed to writing the same code sections more than once).
r2997790
Posts: 36
Joined: 02 Feb 2017, 02:46

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

22 Dec 2018, 04:28

This is a really wonderful script.

It seems to just have one thing missing to me, which is to handle multi line hotstrings.

If it had that function it would be brilliant (I think it would be just find to replace the linebreaks to `n as it parsed the lines).

Thanks for your hardwork on this. It brings clarity where there was confusion (with so many hotstrings).
Kellyzkorner_NJ
Posts: 18
Joined: 20 Oct 2017, 18:33

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

22 Dec 2018, 22:16

I also think this is a wonderful script (as I've said before). If you are going to be looking at it, for some reason I notice I see the Stop Script heading on the #F1 window and if I mouseover the others I see their dropdowns but not their headings. I'm not sure why. I do use Stardock Windowblinds and I'm on Windows 7 if that has any bearing. I still get the duplicated entries in my list so I'm not sure if it is just looping one more time on the one script it does it on which is the autocorrect one. Anyway thanks again and I'm just throwing that out there. Hope you have happy holidays and enjoy.

Kelly
Last edited by Kellyzkorner_NJ on 25 Dec 2018, 23:49, edited 1 time in total.
Wigi
Posts: 78
Joined: 05 Jun 2017, 10:52
Contact:

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

23 Dec 2018, 21:48

Hello FanaticGuru,

This is indeed a very nice script ! Many thanks !

I have 1 remark. The script fails to record a hotkey like SC029. In fact, at least in Belgium, we have on the keyboard a key just above the Tab key. It is the square key. You get a superscript 2 if you press it. If Shift is pressed, you get a superscript 3. Since I left university quite some time ago, this key is not very useful to me. I use it to:
- copy an entire line (Home, Shift, End, ^c)
- if in Excel: hit F2, ^a, ^c, Esc

My new superscript 3 functionality is to paste, the inverse.

Would it be possible to amend the script such that this is recorded too ? Or, put differently, do I need to start my hotkey in a different way such that it still works but it can be recorded by your script ?

Thank you !
FanaticGuru
Posts: 1272
Joined: 30 Sep 2013, 22:25

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

26 Dec 2018, 13:54

I appreciate all the feedback. I have been busy with Christmas but when I get a chance I will look at incorporating some of the suggestions.

I started working some on 'Help' documentation I can include in the script.

The SC hotkeys I should be able to do. That was an oversight in my RegEx needle to look for hotkeys as I have never used that type definition.

Multi-line hotstrings should be doable. Again just need to look carefully at my RegEx needle to find them in the script.

Will also look at some of the misc. oddities.

No sort at all is a tough one. All the information collected is stored in an AHK object array by Script File Name and Keys. AHK arrays are automatically sorted by the nature of their storage method. All standard arrays in AHK are sorted in some way. It is so AHK can access elements more efficiently. Once information is put into that array, the original order that they were added is lost. I would have to add an index to the array to track order added or maybe use a special type of COM object that preserves order added. Either way that is hard to change as that array is used extensively throughout the script. Different array structures would also be slower, so I am not sure it is worth it for most users. The work around of constructing your comments to get the sort order that you want might be the only alternative.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
r2997790
Posts: 36
Joined: 02 Feb 2017, 02:46

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

26 Dec 2018, 15:59

Thanks FG. This is great news and a must have script in anyone's AHK toolkit.
Merry Christmas to you and happy New year!
joefiesta
Posts: 216
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

26 Dec 2018, 16:17

@Kellyzkorner: I too run win 7, but do not get the behavior you describe. You know, if you have duplicates in the drop down list it could be because you have more than one version of the same script running. There is no law against that.
Have you disabled your "stardock window blinds" to see if that is not the problem? (I have no idea what that pgm is BTW)
Kellyzkorner_NJ
Posts: 18
Joined: 20 Oct 2017, 18:33

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

26 Dec 2018, 19:54

@joefiesta It's occurred to me that the duplicates are being grabbed from more than one copy of the script, especially since it's only that one, although I include a lot, I should just double check I don't have one included twice. Windowblinds by Stardock is a windows skinning program. No I haven't and I'm sure if I disabled or didn't load it, that would work. I don't understand why the stop script always shows regardless. Every once in a while the others will show up. Maybe it's dependent on the skin used? I'm not sure. I would have thought that every drop down menu would show up or none would, that's what confuses me. Thanks for the input and ideas though, I appreciate it.
FanaticGuru
Posts: 1272
Joined: 30 Sep 2013, 22:25

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

04 Jan 2019, 15:03

Updated in First Post

Change Log: Update 2019 01 03
  • Added support for SCxxx and VKxx type Hotkeys
This only displays the SC and VK code used in the Hotkey definition. It does not translate that to an actual character for display.

First translating looks pretty technically difficult and second the display could be problematic as there is probably something odd about the character to start with that required using this method to create the Hotkey.

The comment can of course contain any information needed to identify the key to the user.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
Wigi
Posts: 78
Joined: 05 Jun 2017, 10:52
Contact:

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

04 Jan 2019, 20:30

Many thanks, this last update (2019 01 03) indeed identifies the square key and Shift-square key, that I use in 4 hotkeys:
01.png
01.png (62.92 KiB) Viewed 237 times
zhaowu
Posts: 2
Joined: 07 Dec 2018, 03:49

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

14 Jan 2019, 09:21

Wigi wrote:
04 Jan 2019, 20:30
Many thanks, this last update (2019 01 03) indeed identifies the square key and Shift-square key, that I use in 4 hotkeys:

01.png
Thanks for sharing this little useful tool. :D

This reply is to post a bug and solution concerning duplicate entries. Somehow, each entry displays twice for #include files. I do not fully understand the code, so I just add U option to remove duplicates in each sort as below.

Code: Select all

Sort, Display_Section, U
r2997790
Posts: 36
Joined: 02 Feb 2017, 02:46

Re: Hotkey Help - Display Active AHK Hotkeys and Hotstrings

14 Jan 2019, 09:57

So looking forward to the multiple line hotstring implementation if you can wrangle the RegEx to do it FantasticGuru --- it will help me clean up my messy hotstrings files enormously.

Such a useful and clever bit of scripting.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 51 guests