Jont Posted January 27, 2021 Share Posted January 27, 2021 Hi all. I run a Minecraft server for my son and his pals. I'm using AutoIt overnight to shut down the Minecraft server cleanly, back up the Minecraft world, and restart the server. The server is implemented in Java, and so is a completely opaque window of class SunAwtFrame with no controls, but I give it focus with WinActivate(), click in the command field with MouseClick() - having worked out where to click with the help of WinGetPos() - and Send the command to stop the server with Send(), so it all works...half the time... However, half the time the the WinActivate() and WinGetPos() work, but then the MouseClick() and the Send() appear to do absolutely nothing whatsover. Even the simplest The mouse cursor doesn't even move. But, curiously, if I restart the server manually, it then becomes amenable to the MouseClick() and Send() again. But what could it be about the state of the Minecraft window that prevent even the mouse movement from working? Any ideas what's going on, or how I can work around this very odd behaviour? I've attached a vastly simplified script which exhibits the problem. Cheers, Jont. test.au3 Link to comment Share on other sites More sharing options...
Jont Posted January 27, 2021 Author Share Posted January 27, 2021 Here's the simple script that exhibits the problem: Local $mcSpec="[TITLE:Minecraft server; CLASS:SunAwtFrame]" WinActivate($mcSpec) ; Always works Local $pos=WinGetPos($mcSpec) ; Always works MouseClick("primary",$pos[0]+$pos[2]-30,$pos[1]+$pos[3]-30) ; Doesn't work when the problem occurs Send("/say Automation comms tested and working{ENTER}",0) ; Doesn't work when the problem occurs, even if the text field aready has focus Link to comment Share on other sites More sharing options...
Developers Jos Posted January 27, 2021 Developers Share Posted January 27, 2021 Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts