SendKeys no longer able to activate chat nor press Enter
In previous versions of Minecraft, I was able to use SendKeys (through powershell, VBScript, etc) to open the chat window then enter commands. In 1.13, Minecraft ignores the chat key (t) when sent using sendkeys but if I press it on my physical keyboard then the chat window opens and then the rest of my command can get entered through sendkeys. The Enter key also doesn't get pressed when sent through SendKeys. This is affecting my ability to build large projects using commands and scripts since RCON still isn't thread safe so I can't use that method either. So far I don't have a decent workaround other than building in 1.12.2 then upgrading the world.
Environment
Windows 10 running 1.13 in single player or multiplayer. Using SendKeys through powershell.
Created Issue:
SendKeys no longer able to activate chat nor press Enter
In previous versions of Minecraft, I was able to use SendKeys (through powershell, VBScript, etc) to open the chat window then enter commands. In 1.13, Minecraft ignores the chat key (t) when sent using sendkeys but if I press it on my physical keyboard then the chat window opens and then the rest of my command can get entered through sendkeys. The Enter key also doesn't get pressed when sent through SendKeys. This is affecting my ability to build large projects using commands and scripts since RCON still isn't thread safe so I can't use that method either. So far I don't have a decent workaround other than building in 1.12.2 then upgrading the world.
Environment
Windows 10 running 1.13 in single player or multiplayer. Using SendKeys through powershell.
is duplicated by
"Cannot reproduce" is a bit inaacurate/dishonest, isn't it? Did anyone else even try to reproduce it? Would be more accurate to tag this as "Fixed" if not "did not reproduce."
In case the issue arises again, for future reference: The issue existed and was quite reproducible in versions between the 1.13 pre-releases and 1.16.5. But with 1.17 Mojang fixed something in the code that had been broken with 1.13, which arose at the same time as a dozen other reported issues relating to a change in the game engine's input handling - reference [Mod] Pokechu22's comment in MC-135845:
For context, 1.13 updated to LWJGL 3 from LWJGL 2, which completely changed the way the game gets input (it now uses GLFW). It's possible that something with how GLFW gets input doesn't work well with SendKeys, which I'll have to experiment with.
Then the issue was subsequently fixed (for current and previous releases) with the 1.17 code.
In any case, thanks for closing the ticket.
-m
(preemptively, this issue seems like it is semi-invalid, but I'm still going to investigate it as investigated the RDP issue (MC-126875))
Does it not work for any input, or just chat? For instance, can you press W to move forward? Does it work with using / to open chat with a command prefix?
Can you give a sample powershell script using SendKeys, for testing?
Here is the sample powershell script with some comments, just paste it into a .ps1 file.
I included 2 different sendkey methods. The both methods open the chat window and enter "/say testing" and press enter. Only the 2nd method can actually move a player (very short distance, less than half a block using the code below). Neither method does anything in 1.13 but if I open chat myself then all the sendkey presses will come into the chat (i.e. I'll see t/say testingwwww...) but the sendkey enter won't get pressed either. So chat can see the sendkey presses (except enter) but the key to start chat can no longer be pressed from sendkeys, even if I change the chat key to something else.
Script below:
sleep 10 # Method 1 - This method doesn't work for movement, only for chat (1.12.2). Doesn't do either in 1.13 $wshell = New-Object -ComObject wscript.shell; $wshell.AppActivate('Minecraft 1.13') $wshell.SendKeys("t") Start-Sleep -m 500 # Add half second delay $wshell.SendKeys("/say testing") Start-Sleep -m 500 # Add half second delay $wshell.SendKeys("~") # Presses Enter Start-Sleep -m 2000 # Add 2 second delay $wshell.SendKeys("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwddddddddddddddddddddddddddddd") # Move forward slightly then right slightly Start-Sleep -m 5000 # Add 5 second delay # Method 2 - This method works for movement and chat in 1.12.2 but neither in 1.13 Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.SendKeys]::SendWait("t") Start-Sleep -m 500 # Add half second delay [System.Windows.Forms.SendKeys]::SendWait("/say testing") Start-Sleep -m 500 # Add half second delay [System.Windows.Forms.SendKeys]::SendWait("\{ENTER}"); Start-Sleep -m 2000 # Add 2 second delay [System.Windows.Forms.SendKeys]::SendWait("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwddddddddddddddddddddddddddddd") # Move forward slightly then right slightlyHm, interesting, I'll mess with this some and get back to you when I have time.
For context, 1.13 updated to LWJGL 3 from LWJGL 2, which completely changed the way the game gets input (it now uses GLFW). It's possible that something with how GLFW gets input doesn't work well with SendKeys, which I'll have to experiment with.
Thanks for the info. I'll research GLFW as well and see if I can find anything. If
MC-72390(Rcon is not thread-safe) ever gets fixed, I would at least have a work around by using RCon.Since this issue hasn't been updated for almost four years now, please check if this is still an issue in the most recent version of the game.