HotString Not Working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Silveradoman
Posts: 5
Joined: 17 Mar 2023, 11:18

HotString Not Working

Post by Silveradoman » 17 Mar 2023, 11:25

Code: Select all

#NoEnv
; #Warn
SendMode Input
::monte::{RAW} F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*
return

this is the output -->F4U557$4qIVVJS4uj&#YY46gf5QMS*

What am I doing wrong?


[Mod actions: Moved topic from "Ask for Help (v2)" since this is v1 code. Added [code][/code] tags. Please use them yourself when posting code.]

User avatar
mikeyww
Posts: 26882
Joined: 09 Sep 2014, 18:38

Re: HotString Not Working

Post by mikeyww » 17 Mar 2023, 15:04

Running two different scripts at the same time?

Not showing your whole script?

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: HotString Not Working

Post by gregster » 17 Mar 2023, 17:18

That's not the documented way to apply raw mode to a hotstring - while it might work (?), the docs show :R:monte::. But I would prefer text mode anyway (AHK v1.1.27+):

Code: Select all

:T:monte::

cat dog fox war
Posts: 38
Joined: 15 Mar 2023, 10:18

Re: HotString Not Working

Post by cat dog fox war » 17 Mar 2023, 22:14

Code: Select all

#NoEnv
; #Warn
SendMode Input
::monte::{RAW} F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*
;              F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*
;                              ^  miss `

:T:m1::F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*
;      F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*
;                     ^  miss `

:R:m2::F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*
;      F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*
;                     ^  miss `


::m3::
        ( ` LTrim
            F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*
        ) ; F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*

return
If you are talking about losing `, the m3 may be what you want.
if you are talking about F4U557$4qIVVJS4uj&#YY46gf5QMS* ,the unexpected extra 57 at F4U557$, I can't reproduce.

off
Posts: 176
Joined: 18 Nov 2022, 21:54

Re: HotString Not Working

Post by off » 19 Mar 2023, 04:58

Perhaps:

Code: Select all

#NoEnv
; #Warn
SendMode Input
::monte::
Send, {Raw} F4U5$4qIVVJ7S4uj`%F5QM6gS3yY4*
return
If you want to send `, maybe use double ``

If you wanted to send %, using `{%} send literal %, as far as i know. (Correct me pls)
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess

Silveradoman
Posts: 5
Joined: 17 Mar 2023, 11:18

Re: HotString Not Working

Post by Silveradoman » 20 Mar 2023, 16:00

Thank you to all the replied.
Still can not get this to work.
Any other ideas?


Without the tick for the percent sign. Typing the word monte and hitting space bar

Code: Select all

#NoEnv
; #Warn
SendMode Input
::monte::Send, {Raw} "F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4*
return
This is the result -->end5$ "< F4U4qI&%VJv7S4ujf5QMYY4*G6s3

-----------------------------------------------------------------------
With the tick for the percent sign. Tying the word monte and hitting the space bar

Code: Select all

#NoEnv
; #Warn
SendMode Input
::monte::Send, {Raw} "F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
return
This is the result -->"FEND< 4US4q%$IVVJ7f5QM$UJ&%6gS3yY4*

off
Posts: 176
Joined: 18 Nov 2022, 21:54

Re: HotString Not Working

Post by off » 20 Mar 2023, 20:38

I cannot reproduce your issue, try my script and please send your result. And make sure you're not typing after using the hotstring :D

Code: Select all

:*:montea::
SetKeyDelay, -1
SendMode, Input
MsgBox, 	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
;	"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output

Send,	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
;	"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output

SendInput,	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
;		"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output

Send,	{raw} 	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
;		"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output

SendRaw,	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
;	"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output
Return

:*:monteb::	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
;	"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output

:R:montec::	"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4*
;		"F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* < output
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: HotString Not Working

Post by gregster » 20 Mar 2023, 20:52

gregster wrote:
17 Mar 2023, 17:18
the docs show :R:monte::. But I would prefer text mode anyway (AHK v1.1.27+):

Code: Select all

:T:monte::
This means:

Code: Select all

:T:monte::F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*
(requires AHK v1.1.27+)

you could also try it via the clipboard

Code: Select all

::monte::
clipboard := "F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*"
Send ^v
return
(assuming you are using AHK v1)

Silveradoman
Posts: 5
Joined: 17 Mar 2023, 11:18

Re: HotString Not Working

Post by Silveradoman » 23 Mar 2023, 11:19

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SetKeyDelay, -1
SendMode, Input
:*:monte::
Send,	{raw} 	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
return
this is the output -->mo"F4$44vvjqI7SUJ&%S5FQM6g3yY4*
Still can not get this to work. On version 1.1.27. I'm on Windows 11.


[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

off
Posts: 176
Joined: 18 Nov 2022, 21:54

Re: HotString Not Working

Post by off » 23 Mar 2023, 16:34

Now im not sure is this man really has the issue or not.
Please use MsgBox, and screenshot the result msgbox ontop notepad opening your script.
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: HotString Not Working

Post by gregster » 23 Mar 2023, 18:33

Silveradoman wrote:
23 Mar 2023, 11:19

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SetKeyDelay, -1
SendMode, Input
:*:monte::
Send,	{raw} 	"F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
return
this is the output -->mo"F4$44vvjqI7SUJ&%S5FQM6g3yY4*
Still can not get this to work. On version 1.1.27. I'm on Windows 11.
Generally, explaining the context of your problem might also help. Where are you trying to use this hotstring? A cmd window? A RDP session?

But anyway you are still not trying what I suggested twice.... text mode, and also not the alternative method of pasting the clipboard. No idea what else to tell you, if you ignore the suggestions 🤷‍♂️ Good luck!

Silveradoman
Posts: 5
Joined: 17 Mar 2023, 11:18

Re: HotString Not Working

Post by Silveradoman » 27 Mar 2023, 13:54

gregster,
This is my results from your suggestion

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
:T:monte::F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*


mogS37S4uU5$4qIVVJj%F5QM6yY4* <--- output still not right.

-------------------------------------------------------------------------------------
This is using clipboard

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
::monte::
clipboard := "F4U5$4qIVVJ7S4uj%F5QM6gS3yY4*"
Send ^v
return
[Mod edit: [code][/code] tags added.]

F4U5$4qIVVJ7S4uj%F5QM6gS3yY4* <---- output. This works but can not use clipboard on my application.

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: HotString Not Working

Post by gregster » 27 Mar 2023, 14:16

gregster wrote:
23 Mar 2023, 18:33
Generally, explaining the context of your problem might also help. Where are you trying to use this hotstring? A cmd window? A RDP session?
My guess is that your target application is somehow interfering. Perhaps some auto-completion mechanism kicks in, perhaps AHK is sending the characters too fast for it.
Or perhaps you are using an older AHK version with some hotstring bug. Are you using the up-to-date v1 version, 1.1.36.02?
Or do you have other hotstrings which get triggered accidentally by this series of sent characters? Did you test with just this one hotstring and nothing else active? I would start my tests in Notepad.
Do you also have problems with other hotstrings?

As we still know nothing about the target application, and can't reproduce your problems, any advice can only be of general nature. Perhaps experiment with different send modes and key delays. Or use the related hotstring options Kn and SI/SE/SP, also in combination with T. I would start to test with shorter strings and see if a pattern emerges; first in Notepad, which is quite basic and tolerant - then in the actual target application. After all, most programs are not made or optimized for accepting artificial input. That's why I would suggest a systematic trial-and-error approach.


PS: Please start to use [code][/code] tags around code. In the full editor there is even a button to insert them. Just select the code and press the fifth button from the left. Thank you!

codetags.gif
codetags.gif (818.65 KiB) Viewed 930 times

Silveradoman
Posts: 5
Joined: 17 Mar 2023, 11:18

Re: HotString Not Working

Post by Silveradoman » 27 Mar 2023, 15:54

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.~~`
Send Mode input 
~::
Send, {RAW}F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*
return
[Mod edit: [code][/code] tags added.]

F4U5$4qIVVJ7S4uj&%F5QM6gS3yY4* <--- finally got this to work!
Thank you for all the tips!
Was trying to paste this password into a Windows 16 server login screen.

gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: HotString Not Working

Post by gregster » 27 Mar 2023, 17:05

Okay, you now used a hotkey instead of a hotstring. Since the hotstring's backspacing seemingly didn't work correctly on the login screen, this seems like a good idea. I still don't understand how the other apparent problems have been solved this way.

But wait... there is another change. You are now using Sendevent mode (likely unintentionally) - the default sendmode in AHK v1 - because this line

Code: Select all

Send Mode input
doesn't actually set the sendmode to Input, but sends the literal string Mode input (only once at script start, but you might want to remove that line, so that these characters don't show up at random places). You have a space too much in there: Sendmode Input would actually set the sendmode to input. So using the default event mode probably was the solution in this particular case.
You could have used 'event' mode also with a hotstring (SE option, because hotstrings use Sendinput mode by default, afaik), but it might not have solved the backspacing problem.

Thanks for the feedback!

Alternatively, if you want to keep Input as the main sendmode, you could do this:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.~~`
SendMode input 	; fixed, by removing a space between send and mode; now the default sendmode is 'Input' and not 'event' anymore
~::
SendEvent, {RAW}F4U5$4qIVVJ7S4uj&`%F5QM6gS3yY4*	; only use sendevent mode for this single line
return

PS: Please remember to use code tags, so that we can avoid the extra work of editing each of your posts. Or is there a question ?

Post Reply

Return to “Ask for Help (v1)”