Weird problem with SendInput and Windows 11 Notepad

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
robnicholson
Posts: 12
Joined: 07 May 2020, 07:38

Weird problem with SendInput and Windows 11 Notepad

06 May 2023, 11:44

Very simple macro:

^+a:: Send "Hello, World{enter}"

Use this in the native Notepad app on Windows 11 and it types "He". As you let go of Ctrl-Shift-A, two more characters are typed. Tap the shift key and each character is revealed.

Use SendInput and it manages to get "Hell" out but then the same effect.

What's going on?
User avatar
boiler
Posts: 17327
Joined: 21 Dec 2014, 02:44

Re: Weird problem with SendInput and Windows 11 Notepad

06 May 2023, 13:39

Does the Notepad app in Windows 11 have some type of auto-fill text option? Any other similar options that are different from the Win 10 version that you can identify?
User avatar
mixer
Posts: 9
Joined: 25 Nov 2021, 00:46

Re: Weird problem with SendInput and Windows 11 Notepad

06 May 2023, 18:06

Try this

Code: Select all

^+a:: {
    KeyWait "Control"
    KeyWait "Shift"
    Send "Hello, World{enter}"
}
But the text will be displayed only after releasing the buttons Ctrl & Shift
robnicholson
Posts: 12
Joined: 07 May 2020, 07:38

Re: Weird problem with SendInput and Windows 11 Notepad

08 May 2023, 09:40

mixer wrote:
06 May 2023, 18:10
In Windows 11 notepad redesigned
It must be something to do with this re-design as I've just tried the same v2 script on Windows 10 notepad.exe and no problems.

Now it's not a big deal as I personally use Notepad++ and most of my macros are actually destined for use elsewhere, e.g. typing email addresses and other text into emails and web pages.

But it's clearly a bit of an issue.
fhammer
Posts: 1
Joined: 14 Nov 2022, 12:27

Re: Weird problem with SendInput and Windows 11 Notepad

25 Jun 2023, 16:42

I'm having the exact same problem. Using KeyWait didn't solve the problem. However:

A_Clipboard := "Hello, World{enter}"
Send "^v:

did work for me.
User avatar
mikeyww
Posts: 27302
Joined: 09 Sep 2014, 18:38

Re: Weird problem with SendInput and Windows 11 Notepad

25 Jun 2023, 20:28

Problem also verified here. Very strange behavior. I changed hotkey to F3 with no improvement. Using SendEvent with default key delay does resolve the issue, but it's still rather bizarre and unexplained. Warrants investigation.

Stranger yet: moving the mouse causes the remainder of the missing text to be sent or to appear. Could it be a redraw problem?

This probably sounds immediately familiar to someone who knows exactly what the problem is. Although this seems unlikely to be an AutoHotkey bug per se, it might be something that needs adjustment.

viewtopic.php?f=14&t=118816
User avatar
flyingDman
Posts: 2843
Joined: 29 Sep 2013, 19:01

Re: Weird problem with SendInput and Windows 11 Notepad

25 Jun 2023, 21:59

I had noticed something similar. When moving the mouse additional text appears. I blamed it on a local issue but now see others experience the same. This seems to have appeared in the past week or so.
14.3 & 1.3.7

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: diegg1739, niCode and 24 guests