Skoven Posted June 10, 2015 Share Posted June 10, 2015 (edited) Hello!Im new to autoit. I have been trying to make a small script for saving and backing up a small minecraft server im hosting. I've tried making this Work for several days now, without luck. The thing is, i have more or less made a working script now. But sometimes the script only does some of the Things its supposed to, and other times it runs the Whole thing without issue. I have no idea what the cause of this is, since nothing is changing on my server. My code is as follows:expandcollapse popup#RequireAdmin Global $variabel = 0 While 1 if WinExists("C:\Windows\system32\cmd.exe") Then WinClose("C:\Windows\system32\cmd.exe") EndIf Sleep(2000) Run("F:\FTB\ServerStart.bat") Sleep(180000) While $variabel < 7 WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is saving, please standby..") Send("{ENTER}") Sleep(1000) Send("save-off") Send("{ENTER}") Sleep(1000) Send("save-all") Send("{ENTER}") Sleep(5000) Run("F:\FTB\ServerBackup.bat") Sleep(20000) Send("save-on") Send("{ENTER}") Sleep(500) Send("say Done saving..") Send("{ENTER}") $variabel += 1 Sleep(900000) WEnd If $variabel = 7 Then WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 15 minutes. Please log out before that time") Send("{ENTER}") Sleep(300000) WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 10 minutes. Please log out before that time") Send("{ENTER}") Sleep(300000) WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 5 minutes. Please log out before that time") Send("{ENTER}") Sleep(60000) WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 4 minutes. Please log out before that time") Send("{ENTER}") Sleep(60000) WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 3 minutes. Please log out before that time") Send("{ENTER}") Sleep(60000) WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 2 minutes. Please log out now") Send("{ENTER}") Sleep(60000) WinActivate("C:\Windows\system32\cmd.exe") Send("say Server is restarting in 1 minutes. Please log out now") Send("{ENTER}") Sleep(60000) WinActivate("C:\Windows\system32\cmd.exe") Send("say RESTARTING NOW!") Send("{ENTER}") Sleep(5000) Send("save-off") Send("{ENTER}") Sleep(5000) Send("save-all") Send("{ENTER}") Sleep(10000) Send("stop") Send("{ENTER}") Sleep(10000) Send("{ENTER}") Sleep(1000) Run("F:\FTB\ServerBackup.bat") Sleep(10000) EndIf WEnd It is a shitty code i know. The reason im caling Winactivate on each input, is because i thought that might the cause of my problems. But it seems i doesnt. Im basically trying to start my server from the script, then save an backup a few times, and then end it with restarting server by closing it. Its run through console, hence the use of "Send" commands. I've tried solving this by myself without luck, and now i hope for someone to enligthen me, as im sure the fault lies between my chair and my keyboard. Hope to hear from you, Cheers. Edited June 11, 2015 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
TheDcoder Posted June 10, 2015 Share Posted June 10, 2015 Please read the forum rules, Game Automation is not allowed TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
water Posted June 10, 2015 Share Posted June 10, 2015 I'm not sure this is against the forum rules. He just does a backup of a game server.Let's see what the Mods say. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
TheDcoder Posted June 10, 2015 Share Posted June 10, 2015 (edited) Remember, when my topic was locked by smoke_n? Edited June 10, 2015 by TheDcoder correction EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
czardas Posted June 10, 2015 Share Posted June 10, 2015 (edited) I concur with Water. It is not so easy to view this as game automation. Edited June 10, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted June 10, 2015 Share Posted June 10, 2015 Remember, when my topic was locked by smoke_n? He is entitled to do that. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Skoven Posted June 10, 2015 Author Share Posted June 10, 2015 Im sorry i didnt think it would go under these rules, as im just trying to maintain my server. I'll just have to sort it myself then.Im sorry for any inconvenience. Link to comment Share on other sites More sharing options...
water Posted June 10, 2015 Share Posted June 10, 2015 Skoven,let's see what a Moderator says. I've reported this thread and I'm sure soon a Mod will post his opinion My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Juvigy Posted June 10, 2015 Share Posted June 10, 2015 The problem is your winactivate and send - you shouldnt use them.As i can see you are only starting cmd commands . For example Runwait or Run:RunWait(@comspec & " /c say RESTARTING NOW! ",@sw_hide) Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2015 Developers Share Posted June 10, 2015 I'll let it go for the moment but please make sure we stay without the scope of our forum rules!Jos 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...
TheDcoder Posted June 10, 2015 Share Posted June 10, 2015 @Jos So, is it a Green Signal? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Developers Jos Posted June 10, 2015 Developers Share Posted June 10, 2015 (edited) @Jos So, is it a Green Signal?Not sure which part of my post was unclear to you, but you are slowly getting on my nerves with your posting style lately, so please back off and only post in a thread when you have actually something substantial to contribute. This is a statement and does not require response in this thread and when you want to discuss anything you can do it in PM with me.Jos Edited June 10, 2015 by Jos Jewtus 1 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...
Skoven Posted June 10, 2015 Author Share Posted June 10, 2015 The problem is your winactivate and send - you shouldnt use them.As i can see you are only starting cmd commands . For example Runwait or Run:RunWait(@comspec & " /c say RESTARTING NOW! ",@sw_hide)I'll admit i don't know what you are talking about. As i just said, i've just started using autoit, and as such the programming language is still very foreign to me. Problem is, the minecraft server runs as a command console, therefore im forced to "Send" the commands to the console, because the minecraft server runs within. I'm not sure if that helped anything or not. Appreciate the help though. Link to comment Share on other sites More sharing options...
232showtime Posted June 11, 2015 Share Posted June 11, 2015 (edited) I concur with Water. It is not so easy to view this as game automation.I'll let it go for the moment but please make sure we stay without the scope of our forum rules!Josso what about this???FORUM RULES:Launching, automation or script interaction with games or game servers, regardless of the game. Edited June 11, 2015 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
czardas Posted June 11, 2015 Share Posted June 11, 2015 (edited) so what about this???FORUM RULES:Launching, automation or script interaction with games or game servers, regardless of the game.Ah! Not game automation, but interaction with a game server. I don't know enough about the subject, but I fail to see any game-play advantage gained by a backup script. Strictly speaking you are right though. Edited June 11, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Skoven Posted June 11, 2015 Author Share Posted June 11, 2015 (edited) All right, it seems people find it more entertaining punching rules, than helping in here, event though everyone knows im just trying to communicate with a command promt. Will an admin please delete this thread.. Edited June 11, 2015 by Skoven Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 11, 2015 Moderators Share Posted June 11, 2015 232showtime,When a Mod has already said only a few posts above yours that the thread is legal, why on earth do you feel the need to jump in and start the discussion all over again?Skoven,As you may have noticed, gaming is a very touchy subject here and some wannabee-Mods get all excited about any hint of it. You have both active Mods saying that the thread is permissible so, given that this one is now so polluted, I suggest you start a new one and link to this one to show that the question is allowed. I will lock this one to prevent any more silliness.BEWARE: anyone who starts off questioning the legality of the new thread is going to get very short shrift indeed.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Developers Jos Posted June 11, 2015 Developers Share Posted June 11, 2015 so what about this???FORUM RULES:Launching, automation or script interaction with games or game servers, regardless of the game.Sending me a PM saying you sorry for " quoting me" and "Just asking" doesn't mean much since you did more than that. You are actually questioning me!I will be the first one to admit that I make mistakes on a regular basis, but in case anyone feels that has happened it would be nice when a nice constructive PM is send on that in stead of a reply like this.Next time I am questioned like this, that member will get a short vacation from these forum as I seriously don't think anybody of the team has to account for these type of decisions to you or anybody else other than the other teammembers.Jos 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