Issue Sending {enter} Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Issue Sending {enter}

14 Aug 2017, 02:04

Hello! I am wondering why this doesn't work:

Code: Select all

a::send, hi{enter}
it sends "hi{enter}", not "hi
"

this problem only seems to happen enter. It works just fine with other keys needing braces, such as {!}, {bs}, and {volume_up}. This workaround seems to work, but I don't like it:

Code: Select all

a::send, hi {bs}{enter}
Is there a reason why this is not working?
I am using AutoHotkey v1.1.26.01

Thanks!
I have no idea what I'm doing.
Sumguy
Posts: 2
Joined: 14 Aug 2017, 02:02

Re: Issue Sending {enter}

14 Aug 2017, 02:10

Hey, this works for me:

Code: Select all

a::
Send, Hi {Enter}
Return
I added a space between "Hi" and "{Enter}" and also added the Return.

Hope it helps.
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

14 Aug 2017, 02:23

Sumguy wrote:Hey, this works for me:

Code: Select all

a::
Send, Hi {Enter}
Return
I added a space between "Hi" and "{Enter}" and also added the Return.

Hope it helps.
Yeah, I noticed that, too. However, I do not want a space after "hi", so I put "hi {bs}{enter}". But as I said, though it works, I don't like that solution. What I'm wondering is if this is a bug (which I'm sure it is) and if there is a fix for it. Thanks for replying!
I have no idea what I'm doing.
gregster
Posts: 9012
Joined: 30 Sep 2013, 06:48

Re: Issue Sending {enter}

14 Aug 2017, 12:30

buttshark wrote:Hello! I am wondering why this doesn't work:

Code: Select all

a::send, hi{enter}
it sends "hi{enter}", not "hi

Is there a reason why this is not working?
I am using AutoHotkey v1.1.26.01
I actually cannot reproduce your problem. On AHK v1.1.26.01 (with Win7 64bit) I always get only "Hi" and a new line...
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Issue Sending {enter}

14 Aug 2017, 13:23

buttshark wrote:Hello! I am wondering why this doesn't work:
It works for me also, same as for gregster.
buttshark wrote:What I'm wondering is if this is a bug (which I'm sure it is)
I'm sure it is a bug. Post the rest of your code for any forum member who is attempting to find it. :)
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

14 Aug 2017, 16:15

wolf_II wrote:Post the rest of your code for any forum member who is attempting to find it. :)
That's it. My entire script was:

Code: Select all

a::send, hi{enter}

esc::exitapp
something that I noticed, though: sometimes it works, and sometimes it doesn't. I can't find a pattern, so I just attached an mp4 file showing what is going on. (I start the script and start pressing "A" in random places)

*note: I couldn't upload an mp4 file by itself, so I just changed the extension to .txt. You will want to change it back before using it.
Attachments
bug.txt
(262.97 KiB) Downloaded 43 times
I have no idea what I'm doing.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Issue Sending {enter}

14 Aug 2017, 16:30

Is it only in Notepad++?
I tested with different editors (SciTE4AHK, Notepad, Metapad, also this forum editor using Firefox) where it works reliably.
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

14 Aug 2017, 17:10

wolf_II wrote:Is it only in Notepad++?
I tested with different editors (SciTE4AHK, Notepad, Metapad, also this forum editor using Firefox) where it works reliably.
Yeah, strange. I can't replicate this bug anywhere else. I assume you have no idea how to fix this in Notepad++, though? If not I guess I'll just live with it or change text editors for ahk.

Thanks!
I have no idea what I'm doing.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Issue Sending {enter}

14 Aug 2017, 17:28

What about this?

Code: Select all

a::send, hi`n
Or this?

Code: Select all

a::
send, hi{enter}
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

14 Aug 2017, 18:04

jeeswg wrote:What about this?

Code: Select all

a::send, hi`n
Or this?

Code: Select all

a::
send, hi{enter}
return
Thanks, but unfortunately that doesn't work. your first example sends "hi`n" and your second's output is identical to the "a::send, hi{enter}" version.
I have no idea what I'm doing.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Issue Sending {enter}

14 Aug 2017, 18:10

Anyway, mentioning this, like the last ones, just in case:

Code: Select all

Send, % "hi{enter}"
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

14 Aug 2017, 19:12

jeeswg wrote:Anyway, mentioning this, like the last ones, just in case:

Code: Select all

Send, % "hi{enter}"
Unfortunately not :(
I have no idea what I'm doing.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Issue Sending {enter}

14 Aug 2017, 19:37

Another possibility, just in case.

Code: Select all

q:: ;send text via WM_CHAR
ControlGetFocus, vCtlClassNN, A
vText := "hi`n"
Loop, Parse, vText
	PostMessage, 0x102, % Ord(A_LoopField), 1, % vCtlClassNN, A ;WM_CHAR := 0x102
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Issue Sending {enter}

14 Aug 2017, 19:59

I copied the text from the OP 1st codebox and converted it to hex and did nothing more.

The result : hidden garbage.
Attachments
send hi.PNG
send hi.PNG (1.07 KiB) Viewed 3124 times
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: Issue Sending {enter}  Topic is solved

14 Aug 2017, 20:59

Is it possible that you have autocomplete in notepad++ which show a box with hi{enter} (because you have it in your file) and then the enter selects it in the box?

Yes, that's what happens, I can even see it in your video.
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

15 Aug 2017, 01:49

obeeb wrote:Is it possible that you have autocomplete in notepad++ which show a box with hi{enter} (because you have it in your file) and then the enter selects it in the box?

Yes, that's what happens, I can even see it in your video.
Ah, yes! That makes sense. Thank you! I'm surprised that wasn't caught until now. Cheers.
I have no idea what I'm doing.
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

15 Aug 2017, 01:57

jeeswg wrote:Another possibility, just in case.

Code: Select all

q:: ;send text via WM_CHAR
ControlGetFocus, vCtlClassNN, A
vText := "hi`n"
Loop, Parse, vText
	PostMessage, 0x102, % Ord(A_LoopField), 1, % vCtlClassNN, A ;WM_CHAR := 0x102
return
Though this may work, it is quite, you'll have to forgive me, ugly. Like in my initial post, "Send, hi {bs}{enter}" worked just fine, and even that seemed rather obnoxious. I appreciate your help, but as obeeb pointed out, it turns out it's Notepad++ with the problem, not AutoHotkey. Thanks again!
I have no idea what I'm doing.
buttshark
Posts: 62
Joined: 22 Apr 2017, 20:57

Re: Issue Sending {enter}

15 Aug 2017, 01:58

Xtra wrote:I copied the text from the OP 1st codebox and converted it to hex and did nothing more.

The result : hidden garbage.
LOL you'll have to forgive me, but I have no idea what I'm looking at. Why did you convert it into hex, and how does this help?
I have no idea what I'm doing.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Issue Sending {enter}

15 Aug 2017, 02:46

Converting to hex shows chars you can not visibly see.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Issue Sending {enter}

15 Aug 2017, 05:25

You can send unicode enter to avoid triggering the auto complete, eg,

Code: Select all

a::send hi{u+a}
Cheers.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], OrangeCat, songdg and 275 guests