[Hotstrings] Expand parameters for AHK's functions, commands and directives.

Discuss features, issues, about Editors for AHK
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

[Hotstrings] Expand parameters for AHK's functions, commands and directives.

07 Feb 2017, 12:33

Introduction
These are circa three hundred, ready-to-use hotstrings for expanding AHK's built-in functions, commands and directives. Also try this nice script by boiler: Insert AHK Command/Function Parameters (with Search/Auto-Complete).

Download

ahkHotstrings.ahk
(18.24 KiB) Downloaded 744 times

How to use
Type a function/command and press tab to expand its parameters,
Preview

Some commands and functions can be called in more than one way, these parameters can be cycled with tab, eg,
Preview

I reccomend making all hotstrings context sensitive for your editor, eg

Code: [Select all] [Download] GeSHi © Codebox Plus

#IfWinActive, ahk_exe notepad++.exe

Known issues and limitations

  • Very limited testing.
  • AutoGUI users will have more luck using Insert AHK Command/Function Parameters (with Search/Auto-Complete) by boiler. Edit: AutoGUI has similar built-in features, see this comment.
  • To enable the cycling, #InputLevel,1 is used for the hotstrings.
  • May lack some relevant hotstrings.
  • May contain some irrelevant hotstrings.
  • I choose not to expand output variables.
  • Hotstring option ? is not present on functions that should follow an object-dot, eg, File.RawRead(...). This might be changed. You are welcome to do it for me ;)
Missing hotstrings, add if desired:

Code: [Select all] [Download] GeSHi © Codebox Plus

:OB0:StrSplit::(String [, Delimiters, OmitChars])
:OB0:StrReplace::(Haystack, SearchText [, ReplaceText, OutputVarCount, Limit := -1])

Credits
All credit goes to forum member jeeswg for generating this list which I have reduced to this,

Code: [Select all] [Expand] [Download] (raw.ahk)GeSHi © Codebox Plus


which is the basis for this script.
Misc
As far as i'm concerned, you may use this in any way and any context you like.
Good luck :wave:
Edit: Fixed cycle bug. (Ty Relayer)
Last edited by Helgef on 09 Aug 2017, 03:39, edited 4 times in total.
User avatar
Relayer
Posts: 115
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

07 Feb 2017, 14:14

Helgef,

Small bug... example is 'loop' does not toggle through all of the defined hotkeys because some of them are typed with an alphanumeric preceding them as opposed to a space. The :O: in that case needs to be :O?: in order for the next one to trigger.

Relayer
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

07 Feb 2017, 14:24

Thank you, I think I messed up this version, I removed all ? Because some hotstrings triggered inside some others, but as you point out, they need to remain in the cycles.
Edit: Fixed, updated code.
Last edited by Helgef on 07 Feb 2017, 15:39, edited 1 time in total.
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

07 Feb 2017, 14:44

Thank you. I use Notepad2-mod because it can autocomplete any word in the file and this was the one feature from SciTE4AutoHotkey I've always wanted in Notepad2 :-)
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

08 Feb 2017, 06:35

Hi qwerty12.
I used to use SciTE, and there I had these popups to show the parameters, but sometimes they closed before I was done.
popup.png
popup.png (3.01 KiB) Viewed 7173 times

I switched (back) to np++ though, there were some problems with scite.
What I would like to extend this to, is to make it work when I autocomplete a command in np++. :think: I guess I could make hotstrings for that too.
Notepad++ also autocompletes any word in the file, an excellent feature.
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

08 Feb 2017, 11:01

Hey Helgef,

Sorry, yeah, the popups are what I meant. Notepad2-mod I install out of necessity (I always seem to end up with files with UNIX line endings, and I hate loading such files into Wordpad because of MS Notepad's inability to handle such files).

Thanks for the NP++ pointer - I've used it sporadically over the years, abandoning it for Notepad2-mod in the end (my needs from a text editor are simple :D), but Notepad2-mod isn't playing nice with my dark Windows theme so I should take another look.

Anyway, thank you again for the script! I wish I could add things to it (as silly as it sounds when it comes to a language named AutoHotkey, my actual hotkey knowledge is really poor), but it's honestly working great for me as it is. I have no need to open up the help file to see functions' parameter positions anymore!

EDIT: In reply to your reply below, :thumbup: Thanks, I'll take a look at that thread :-)
Last edited by qwerty12 on 08 Feb 2017, 12:42, edited 1 time in total.
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

08 Feb 2017, 12:19

qwerty12 wrote:Thanks for the NP++ pointer

Here is another one, Setup Notepad++ for AutoHotkey ;)

qwerty12 wrote:no need to open up the help file to see functions' parameter positions anymore!

Exactly my main reason for this script, expand, delete what's not needed, and keeping those commas :thumbup:
User avatar
noname
Posts: 507
Joined: 19 Nov 2013, 09:15

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

09 Feb 2017, 07:18

This will be a major addon looking at how well the first tries went .Thanks for sharing Helgef :)
guest3456
Posts: 2357
Joined: 09 Oct 2013, 10:31

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

09 Mar 2017, 07:06

This is awesome, I should port this to Vim but I'm too lazy. This could be great for snippet replacements

User avatar
boiler
Posts: 2372
Joined: 21 Dec 2014, 02:44

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

10 Mar 2017, 11:49

This is really great. Thanks for sharing. What is strange is that it works instantly like in your attached preview videos in most editors I tried (Notepad, Sublime Text 3, CodeQuickTester), but it's slow when used in SciTE4AutoHotkey and very slow in Notepad++ (the one I really want it for). You can see it going through all kinds of machinations before it displays the text, especially when tabbing through various options like your "loop" example. Any idea why that might be the case?

EDIT: I see what is causing it in Notepad++. Once I turned off Notepad++'s auto-completion, it works great. Do you have auto-completion turned off on yours? (I realize that your hotstrings won't work if I let auto-complete finish the command/function name, but it's nice to have to auto-complete other things)
guest3456
Posts: 2357
Joined: 09 Oct 2013, 10:31

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

10 Mar 2017, 12:08

boiler wrote:This is really great. Thanks for sharing. What is strange is that it works instantly like in your attached preview videos in most editors I tried (Notepad, Sublime Text 3, CodeQuickTester), but it's slow when used in SciTE4AutoHotkey and very slow in Notepad++ (the one I really want it for). You can see it going through all kinds of machinations before it displays the text, especially when tabbing through various options like your "loop" example. Any idea why that might be the case?

EDIT: I see what is causing it in Notepad++. Once I turned off Notepad++'s auto-completion, it works great. Do you have auto-completion turned off on yours? (I realize that your hotstrings won't work if I let auto-complete finish the command/function name, but it's nice to have to auto-complete other things)


maybe you could try changing the endchar in Helgef's hotstrings

Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

10 Mar 2017, 13:13

I'm using it in notepad++, the previews are made there too, but I turned off autocomplete for the previews. But I have re-enabled it since, and I didn't notice any problems. I'll take a look at again when I get back to the computer.
You are right about that you cannot autocomplete with notepad++ and trigger the hotstrings. I'm working on that, in a somewhat idle pace. :yawn:
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

10 Mar 2017, 14:22

@guest3456, about the endchar, good point, tab can also trigger the auto complete, so there it a potential for trouble. Actually, #Hotstring EndChars `t shouldn't really be there at all, that's just my personal preference.
@boiler, you can also try to replace SendMode, Input, with SetKeyDelay,-1,-1.
User avatar
boiler
Posts: 2372
Joined: 21 Dec 2014, 02:44

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

10 Mar 2017, 14:53

Thanks for the suggestions, guys.

Changing the EndChar didn't help. I think that's because auto-complete is happening well after it's triggered by the end key. It gets triggered and re-triggered simply by the text that's output by the hotstring script. As the hotstring's output is being typed out, the auto-complete keeps trying to open dropdown lists (you can see windows flashing and disappearing as the hotstring result gets partially typed out).

Changing the SendMode line to SetKeyDelay seems to also have helped some. I still see all the dropdown windows flash, but it happens faster. So maybe I'll go with it like this. The difference is mainly just aesthetics (and a little slower), so I maybe it's worth it to leave auto-complete on.

In any event, this hotstring script is super helpful, and because of it, I'm probably going to be using Notepad++ as my regular AHK editor.
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

08 Apr 2017, 11:09

It seems like :OB0:StrSplit::(String [, Delimiters, OmitChars]) is missing, just add it to (eg) the end of the script, if desired.
I might update the script later, when I feel less lazy. :|
Edit:
Another missing:

Code: [Select all] [Download] GeSHi © Codebox Plus

:OB0:StrReplace::(Haystack, SearchText [, ReplaceText, OutputVarCount, Limit := -1])
Asmodeus
Posts: 43
Joined: 19 Oct 2015, 15:53

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

04 Aug 2017, 17:07

Helgef wrote:parameters can be cycled with tab, eg,
unfortunatelly it's not working in AutoGUI, pressing tab deletes parameters.

Image
Helgef
Posts: 3094
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

04 Aug 2017, 18:03

Hello.
It seems AutoGUI doesn't cooperate well with any hotstrings. You can ask for help in the AutoGUI thread regarding that. I'd recommend you try this nice script by boiler: Insert AHK Command/Function Parameters (with Search/Auto-Complete).
boiler wrote:It currently works with Notepad++, SciTE4AutoHotkey, AHK Studio, and AutoGUI. It should work with any editor that accepts pasted text and returns caret positions by adding the editor's WinTitle to the ahk_group.

My emph

Cheers.

Edit: I just tried and boiler's scrip seems to work very well in autogui :thumbup:
Asmodeus
Posts: 43
Joined: 19 Oct 2015, 15:53

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

04 Aug 2017, 18:23

thanks.

i tried out the other script but unfortunately I find it not very intuitive, at least in my work-flow I'd rather prefer this one.
User avatar
Alguimist
Posts: 262
Joined: 05 Oct 2015, 16:41

Re: [Hotstrings] Expand parameters for AHK's functions, commands and directives.

06 Aug 2017, 16:56

Expansion of parameters in AutoGUI is done with Ctrl+Insert or by clicking the calltip.

Return to “Editors”

Who is online

Users browsing this forum: No registered users and 2 guests