rikka Posted December 19, 2023 Share Posted December 19, 2023 So, starting from the beginning. I have a minecraft spigot server on windows 10 (running on my own raw iron with an i7 10700 and 32GB DDR4 if that info is helpful) and im attempting to make a script that will run from task scheduler to stop the server using the /stop command from its console, wich saves all the worlds rather than just resetting the machine every night with task scheduler directly. I'm running into a wierd issue with sending enter to the console window (witch is the CMD window generated by the following .bat script) half the time I try to use send ("{ENTER}") from autoIT, it just puts the console window in fullscreen as if I had pressed ALT+ENTER. IDK if its any help to know, but im also running the box headless in my homelab rack and interface with it exclusively through windows remote desktop. the following is the .bat script that makes the console window and starts the server title PatrickServer java -DIReallyKnowWhatIAmDoingISwear -Xmx30G -Xms30G -jar spigot-1.19.4.jar msg PATRICK watchdog tripped, restart timer initiated timeout 10 shutdown -r -t 0 and here is the autoIT code im trying to use #include <MsgBoxConstants.au3> ;check if the server window is open If WinExists("PatrickServer") Then ;if server window is open, select it as active WinActivate("PatrickServer") sleep (1000) ;now, give the players online a 5 minute warning, a 30 second warning, and a 5 second countdown to the restart Send("say Server will be restarting in 5 minutes!") Send("{Enter}") ;comment out the sleep 270000 and uncomment sleep 1000 to make testing speedier ;sleep (1000) sleep (2700000) ;30 second warning Send("say Server will be restarting in 30 Seconds!") Send("{Enter}") sleep (25000) ;5 second countdown send ("say Server will be restarting in 5 seconds") Send("{Enter}") sleep (1000) send ("say Server will be restarting in 4 seconds") Send("{Enter}") sleep (1000) send ("say Server will be restarting in 3 seconds") Send("{Enter}") sleep (1000) send ("say Server will be restarting in 2 seconds") Send("{Enter}") sleep (1000) send ("say Server will be restarting in 1 seconds") Send("{Enter}") sleep (1000) send ("SERVER RESTARTING") Send("{Enter}") sleep (1000) ;stop the server Send("stop") Send("{Enter}") else ;else, if the window isnt found, let (totally) the greatest sysadmin of all time know that they did a poopy stink msgbox ( $MB_OK, "restart failed", "the system has attempted to restart by using /stop in MCS and failed!" ) EndIf Link to comment Share on other sites More sharing options...
Solution Danp2 Posted December 19, 2023 Solution Share Posted December 19, 2023 Try adding $SEND_RAW to your send statements, like this -- Send("say Server will be restarting in 5 minutes!", $SEND_RAW) P.S. Please read the forum rules to be sure that you don't violate them. rikka 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
rikka Posted December 19, 2023 Author Share Posted December 19, 2023 27 minutes ago, Danp2 said: Try adding $SEND_RAW to your send statements, like this -- Send("say Server will be restarting in 5 minutes!", $SEND_RAW) P.S. Please read the forum rules to be sure that you don't violate them. this solution worked perfectly its worthy of note for future readers that you need to include AutoItConstants.au3 for it to do so Link to comment Share on other sites More sharing options...
Nine Posted December 19, 2023 Share Posted December 19, 2023 But do you understand why $SEND_RAW is working for you ? somdcomputerguy 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
rudi Posted December 21, 2023 Share Posted December 21, 2023 On 12/19/2023 at 10:41 PM, Danp2 said: Try adding $SEND_RAW to your send statements, like this -- Send("say Server will be restarting in 5 minutes!", $SEND_RAW) P.S. Please read the forum rules to be sure that you don't violate them. I'd like to mention the possibility to add the "!" as "{!}" to the send string: This way the option to send special chars in the string is still available. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now