Instant HotString

Post your working scripts, libraries and tools
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Instant HotString

10 Apr 2018, 00:06

hey guys so I was browsing though the ask for help forum and ran into this https://autohotkey.com/boards/viewtopic.php?f=5&t=46988 where the OP was asking for help creating an improved version of https://autohotkey.com/boards/viewtopic.php?f=6&t=46514&hilit=burque505. I decided to take a crack at it and came up with this so far.

what it does:
allows you to create, edit and delete hotstrings on the fly.
saves hotstrings over session

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


[edit} code updated to arochon's version
Last edited by donovv on 15 Apr 2018, 23:15, edited 4 times in total.
User avatar
derz00
Posts: 495
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Re: Instant HotString

10 Apr 2018, 10:40

Yours doesn't improve one of the first issues with burque505's. After saving a hotkey, you can't add another one--the window disappears.

EDIT: Actually, his does have a "Show GUI" button in the tray menu, but it doesn't reset the edit fields
try it and see
...
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Instant HotString

10 Apr 2018, 12:44

derz00 wrote:Yours doesn't improve one of the first issues with burque505's. After saving a hotkey, you can't add another one--the window disappears.

EDIT: Actually, his does have a "Show GUI" button in the tray menu, but it doesn't reset the edit fields


My script does allow for adding multiple if you right click on the tray icon you can press show GUI and it will allow you to add a new one
burque505
Posts: 545
Joined: 22 Jan 2017, 19:37

Re: Instant HotString

10 Apr 2018, 18:25

Nice script, donovv!
Regards,
burque505
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Instant HotString

10 Apr 2018, 18:50

burque505 wrote:Nice script, donovv!
Regards,
burque505


Thank you! Took a lot of inspiration from your script planning on adding a saving feature and working on a few small bugs I noticed today
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

11 Apr 2018, 09:06

Great work on this so far donovv

A few issue I noticed with edited script:

1) If you "save and exit" with the list selection on "select a hotstring to edit" the program throws an error

2)if you "save and exit" with selection on a hotstring you have already created, the program duplicates it the next time you run it

3)show gui command in system tray throws an error
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

11 Apr 2018, 13:08

added this to the top of the script

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

Gui Instant:+LastFoundExist
IfWinExist
{
Gui, Instant:Show
}
else
{


and changed gui destroy commands to gui hide

helped solve a lot of error issues
burque505
Posts: 545
Joined: 22 Jan 2017, 19:37

Re: Instant HotString

11 Apr 2018, 17:41

Nice addition. Just for clarity:

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


I know it's not that hard to figure out, but as posted the 'else' is missing a brace.

Regards,
burque505
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

12 Apr 2018, 21:36

Adapted above version posted.

- Changed GUI
- Disabled all buttons that cause script errors
- Enabled buttons to edit/save when needed
- Auto reloads after saving
- Exit/Minimize added
- Removed tray menu button to show gui (caused errors)
- Eliminated duplicate entry errors
- Removed GUI destroy commands

Let me know what you guys think.....

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

Last edited by arochon on 13 Apr 2018, 17:50, edited 3 times in total.
burque505
Posts: 545
Joined: 22 Jan 2017, 19:37

Re: Instant HotString

13 Apr 2018, 14:15

arochon, it crashes if the replacement text has a paragraph, an empty line, and another pargraph.
Regards,
burque505
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

13 Apr 2018, 14:27

Burque505,

I noticed this as well today. I am looking into remapping or somehow eliminating the use of enter in the “hs2” box or figuring out away to include paragraphs. I’ll spend some time on it tonight. Let me know if you guys have any ideas. I’m also working on a way to import/switch default textfile using select file commands.

Cheers
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

13 Apr 2018, 16:53

Added this to bottom of script to keep from crashing for now. Still looking for a way to include returns without error.

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

#IfWinActive Custom Command Creator
ENTER::SPACE
RETURN::SPACE
NUMPADENTER::SPACE
RETURN
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

14 Apr 2018, 17:16

-Eliminated missing text field crashes by adding error messages and instructions.
-Modified key maps to not allow returns that create errors in hs2 input box
-Added button for select file to change txt document source, still working to make this operable - let me know if you have any ideas.

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

burque505
Posts: 545
Joined: 22 Jan 2017, 19:37

Re: Instant HotString

15 Apr 2018, 13:20

Hi arachon, one modest suggestion:

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

hotstring(":R:"hshandle1[a_index],hshandle2[a_index])

will keep it from choking on control chars, et cetera. Try this for a replacement text with your present code and you'll see what I mean:

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

!ye be a sniveling *$% +black#purple^white/brown cow, now!!!$!@

as a replacement text becomes

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

e be a sniveling *$% Blackurplehite/brown cow, now

and yields some other disconcerting behavior from Windows :)
If you use the ":R:" option for the hotstrings that won't happen.

Regards,
burque505
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

15 Apr 2018, 13:51

burque505,

Thank you for the suggestion. I see what happened with windows controls when replacement text went into the computer.

Where is the best place to insert that line of code?

Thank you,

arochon
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

15 Apr 2018, 13:54

Never mind I found it.

Replaced:

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

hotstring("::"hshandle1[a_index],hshandle2[a_index])
burque505
Posts: 545
Joined: 22 Jan 2017, 19:37

Re: Instant HotString

15 Apr 2018, 18:56

Sorry, that wasn't very clear, my apologies. What I did was replace

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

hotstring("::

with

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

hotstring(":R:

everywhere in the script.
Regards,
burque505
arochon
Posts: 32
Joined: 04 Apr 2018, 07:49

Re: Instant HotString

15 Apr 2018, 19:25

- Updated with :R: option as suggested above
- Added Import command list option
- Added Export command list option


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


Return to “Scripts and Functions”

Who is online

Users browsing this forum: arcticir and 39 guests