How to trigger hotstring from inputbox?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
burton666
Posts: 49
Joined: 09 Dec 2014, 15:26

How to trigger hotstring from inputbox?

10 Jul 2017, 05:17

If I for example have a script which looks like this:

Code: Select all

F2::
inputbox,input, enter something...
send %input%
return

::aa::
send 1{enter}
send 2{enter}
return
How can I press F2 and enter "aa" to have both 1 and two entered in notepad or similar.
When I try it out the hotstring triggers instantly in the inputbox and I only get "1" in notepad.
Guest

Re: How to trigger hotstring from inputbox?

10 Jul 2017, 05:59

You're creating a problem yourself here :-) When you no doubt press enter after typing AA it already executes the AA hotstring and then you also try to fire it. So make it unique by adding _ for example and check if it is a label or end what you've typed, so you can now type AA + enter and it will fire the aa_ hotstring, if you don't need the AA as hotstring at all just make it a normal label. Hotstrings and Hotkeys double as labels (check the docs) which is why you can use IsLabel here in the example below.

Code: Select all

F2::
Inputbox, input, enter something...
If IsLabel("::" input "_")
	Gosub, % "::" input "_"
Else
	Send %input%
WinClassOutputVar:=""
Return

::aa_::
Send 1{enter}
Send 2{enter}
Return
burton666
Posts: 49
Joined: 09 Dec 2014, 15:26

Re: How to trigger hotstring from inputbox?

10 Jul 2017, 06:35

Ok, the problem is that I have some dynamic hotsstrings which looks like this:

Code: Select all

Hotstring("(\b[A-O])(\d)(\d)([012])\s","expand3",3)

Expand3:
{
Send % ($.value(4) = 0 ? "^kPLOCK_LOW{ENTER}PLOCK_LOW." : "^kPLOCK{ENTER}PLOCK.") $.value(1) "." $.value(2) $.value(3) "." $.value(4)"{ENTER 3}"
}
Return
So when I enter for example "A032" it sends:
PLOCK{enter}
PLOCK.A.03.2{enter}

Now I want to be able to use a inputbox in the middle of some tasks and be able to send the correct hotstring. I know I managed to get help from this forum before to accomplish the exact same task. But I lost the script and cant find my post in the forum.

I want to be able to use hotkeys like:

F3::
do some tasks
more tasks..
inputbox(A032)
send PLOCK{enter}
send PLOCK.A.03.2{enter}
some more tasks
return
burton666
Posts: 49
Joined: 09 Dec 2014, 15:26

Re: How to trigger hotstring from inputbox?

12 Jul 2017, 07:52

Nobody else have any ideas?
Guest

Re: How to trigger hotstring from inputbox?

12 Jul 2017, 14:08

Rule number one: always make multiple backups, including offsite. As this is work related so you should never be able to loose it.
Its just plain dumb, sorry to be rude. But I hope you've learned your lesson. And one backup = no backup, you need multiple.

Two: I forgot you always omit half the information in your first few posts :-) So please provide more info in future. Help us to help you.

Three: You can find all your own posts in the current forum by simply clicking your name. :P
If it is the really old forum (which I doubt) you can simply use Google with your username and https://autohotkey.com/board/ (the old forum) the current forum is /boardS/ (so board/ vs boards/).
Your post is here https://autohotkey.com/boards/viewtopic.php?f=5&t=19452 :shock:

Four: So with the function from the linked forum post it becomes something like this

Code: Select all

F2::
Inputbox, input, enter something...
input:=convert(input)
Send % input
Return
:salute: You're welcome to thank me, but ONLY after you've ensured you have setup a proper backup strategy. :thumbup:
If you thank me before you've done so I will not be happy. :thumbdown:
burton666
Posts: 49
Joined: 09 Dec 2014, 15:26

Re: How to trigger hotstring from inputbox?

13 Jul 2017, 00:30

Ok, thanks. To my defence I quit the job where I used the previous script so I did not think I would ever use it again. But now I am back to the same job for a few weeks and realized that it would be really useful.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], MrHue, Rohwedder, songdg and 364 guests