InstantHotstring

Post your working scripts, libraries and tools for AHK v1.1 and older
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

InstantHotstring

01 Apr 2018, 19:17

I like the idea of Jack Dunning's InstantHotkey but I much prefer hotstrings, which I can remember, to hotkeys, which I often can't.
Thus this script. Feedback appreciated, of course.
Load it several times if you need several instant hotstrings.
Note: If you don't enter a hotstring, but do enter a replacement, it's just going to exit without warning (at least in this incarnation).
Edit April 2, 2018. Doesn't exit if you don't enter a hotstring, shows a message and returns to the GUI when you click OK. Now uses clipboard instead of SendRaw.
Edit April 4, 2018. Does require AHK v1.1.28.00+ to be able to run (thanks, derz00)!
Edit April 13, 2018. Changed 'OldClip = Clipboard' to OldClip = %Clipboard%. Yikes...
MAJOR BUG: At present, the hotstrings WILL NOT display '#'. Still looking for a fix 4-13-18
Added :R*: to send hotstring raw.

EDIT: New version April 13, 2018. Now uses clipboard in the proper place, by using NewText := Hotstring(":X*R:"Hstring, "TextAdd").
The label TextAdd now (properly) sends the replacement string via the clipboard. Huge speed increase with large replacement texts.
Spoiler
instant_hotstring.gif
instant_hotstring.gif (138.64 KiB) Viewed 4294 times
Regards,
burque505
Last edited by burque505 on 13 Apr 2018, 20:45, edited 7 times in total.
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: InstantHotstring

04 Apr 2018, 09:05

copied your code and pasted to an ahk file, having issues running it

error: call to nonexistent function

specifically "hotstring(reset)"

line 035
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: InstantHotstring

04 Apr 2018, 09:38

check the required version noted in the second line/comment. This script uses a recent new feature--you need the latest version.
try it and see
...
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: InstantHotstring

04 Apr 2018, 10:16

Thanks, derz00, updated OP so people will know they need v1.1.28.00+ before copying the script.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: InstantHotstring

04 Apr 2018, 20:39

This is a nice tool. Any chance you could get it to output to an ahk file so that the set keys can be saved?
P.S. I am very new to AHK. Loving the simplicity.
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: InstantHotstring

04 Apr 2018, 20:49

Draygoes wrote:This is a nice tool. Any chance you could get it to output to an ahk file so that the set keys can be saved?
P.S. I am very new to AHK. Loving the simplicity.
I always thought, the simplicity of :*:ftw::Free the whales (no ending character needed, like in the script above) is already pretty high.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: InstantHotstring

04 Apr 2018, 21:39

So that is what the script is using? I was thinking that it was exporting as functions because it does not require you to press the space bar to auto replace as ::lol::laugh out loud does.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: InstantHotstring

04 Apr 2018, 21:45

Ok, so I just tested it. Sorry, I had no idea that the above was the difference.
Thank you for your reply.
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: InstantHotstring

04 Apr 2018, 22:01

burque505's script above uses the new Hotstring() function to create a hotstring on the fly, but I think the specific use case for this script is mainly to create temporary hotstrings that I don't want to keep after finishing a specific task. Otherwise, if I wanted to keep a hotstring, I would just use the normal hotstring syntax like shown above and add it directly to a script.

But it would surely be possible to add a hotstring ceated with this script to an ahk-file, for example via FileAppend (this would add it at the end, but that would be fine for a hotstring).

Edited to clarify
Last edited by gregster on 04 Apr 2018, 23:07, edited 1 time in total.
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: InstantHotstring

04 Apr 2018, 22:52

Thanks for your response. The main thing that I wanted to do I have solved, but it probably would not hurt for others using the software if it appends all commands to the end of its own file, or even a new on that can be included at will. Seems like the next logical step to me.
Anyway, I digress. Great work on the program friend! :)
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: InstantHotstring

04 Apr 2018, 23:03

Draygoes wrote:Great work on the program friend! :)
All credits go to burque505 and Jack Dunning for making these "Instant" scripts! ;) I also thank them!
(I was only commenting)
User avatar
Draygoes
Posts: 23
Joined: 04 Apr 2018, 20:11

Re: InstantHotstring

04 Apr 2018, 23:09

Ah, sorry. :oops:
Thanks to the creators of the script!
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: InstantHotstring

13 Apr 2018, 20:47

New version, code updated in OP. Fixed bugs relating to failure to send raw and failure to properly use clipboard.
burque505

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 80 guests