userdsp 1 Posted May 3, 2015 Share Posted May 3, 2015 Please see the second post Link to post Share on other sites
userdsp 1 Posted May 4, 2015 Author Share Posted May 4, 2015 (edited) Please delete my last two post's! I can't edit them. Included system date and clock for last boot This is my first release, please test and comment here! Just put this file at server directory where are start files and start it. If you wish to stop this program look at try icons, right click and press exit. https://drive.google.com/file/d/0B6mBjhaEs6BdSjVlQ0N3Skg2M0U/view?usp=sharing #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: userdsp Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <Date.au3> #include <MsgBoxConstants.au3> Global $iPing, $count, $msgtime While 1 Local $iPing = Ping("google.com") If $iPing Then $count = 0 Else $count += 1 Sleep(1000) EndIf If $count = 10 Then $msgtime += 1 WinClose("ZLOLauncher") WinClose("Battlefield 3™ Server") EndIf If NOT WinExists("Battlefield 3™ Server") And NOT WinExists("ZLOLauncher") And $count = 0 Then Do $iPing = Ping("google.com") Until $iPing > 0 Run("LauncherServer.exe") WinWaitActive("ZLOLauncher") Opt("MouseCoordMode", 2) MouseMove(75, 19, 0) MouseClick( "primary") Sleep(1000) Send("{TAB}") Send("{TAB}") Send("Server offline [ " & $msgtime & " ] times") Send("{Enter}") Send("'Last Server Boot:") Send("{Enter}") Send(_NowTime()) Send("{Enter}") Send(_NowDate()) Run("_StartServer.bat") WinWaitActive("Battlefield 3™ Server") EndIf If NOT WinExists("ZLOLauncher") Or NOT WinExists("Battlefield 3™ Server") Then WinClose("ZLOLauncher") WinClose("Battlefield 3™ Server") EndIf WEnd Edited May 4, 2015 by userdsp Link to post Share on other sites
finn 203 Posted May 4, 2015 Share Posted May 4, 2015 (edited) Opt("MouseCoordMode", 2) MouseMove(75, 19, 0) MouseClick( "primary") It's looks more better: ControlSend('ZLOLAuncher', '', '[CLASS:TButton; INSTANCE:1]', '{SPACE}') And a little addon: If Not FileExists(@ScriptDir & '\Launcher.dll') Then MsgBox(64, 'Info', 'Copy me to the game`s foder!') Exit EndIf Edited May 4, 2015 by finn 1 Link to post Share on other sites
userdsp 1 Posted May 4, 2015 Author Share Posted May 4, 2015 (edited) Yes it look beter but doesn't work But... ControlSend("ZLOLAuncher", "TButton1", "[CLASS:TButton; INSTANCE:1]","") Send("{ENTER}") Works Thx a lot! Edited May 4, 2015 by userdsp Link to post Share on other sites
finn 203 Posted May 4, 2015 Share Posted May 4, 2015 Yes it look beter but doesn't work It's an example only. Run "AutoIt Window Info" and correct the window title and target button properties in my string. After that all gonna works fine. 1 Link to post Share on other sites
userdsp 1 Posted May 4, 2015 Author Share Posted May 4, 2015 It's an example only. Run "AutoIt Window Info" and correct the window title and target button properties in my string. After that all gonna works fine. Just do so from the outset. The names are correct, but does not accept the command ENTER if on the same line. Link to post Share on other sites
finn 203 Posted May 4, 2015 Share Posted May 4, 2015 (edited) Just do so from the outset. The names are correct, but does not accept the command ENTER if on the same line. That's all your need, you can use this "toolkit" as part of your own idea: Opt("WinTitleMatchMode", -1) ; case insensitive, important! While 1 Local $iPing = Ping('ya.ru') ; you can try any other trusted host ; ConsoleWrite($iPing) ; for debug only If $iPing Then ExitLoop _TrayText() Sleep(10000) WEnd ; If ProcessExists('bf3.exe') Then ProcessClose('bf3.exe') ; an example ; If ProcessExists('LauncherServer.exe') Then ProcessClose('LauncherServer.exe') ; an example Run('C:\Users\Admin\Desktop\_Bonus\Battlefield 3\LauncherServer.exe', '', @SW_SHOW) ; change this path to your own WinWaitActive('ZLOLAuncher', 'Connect to master') ControlSend('ZLOLAuncher', 'Connect to master', '[CLASS:TButton; INSTANCE:1]', '{SPACE}') Run('C:\Users\Admin\Desktop\_Bonus\Battlefield 3\bf3.exe', '', @SW_MINIMIZE) Exit Func _TrayText() ; show tray baloons TrayTip("", "", 0) TrayTip("", "Internet connection lost ...", 3, 1) EndFunc ;==>_TrayText Reason for edit : Add comments Edited May 4, 2015 by finn 1 Link to post Share on other sites
Despo 639 Posted May 4, 2015 Share Posted May 4, 2015 Instead of pinging a server permanently you should better check your internet connection itself: AdlibRegister("CheckInet",10000) While True Sleep(1000) WEnd Func CheckInet() If Not _WinAPI_IsInternetConnected() Then MsgBox(64, "", "Internet connection was lost!") AdlibUnRegister("CheckInet") EndIf EndFunc ; #FUNCTION# ==================================================================================================================== ; Author.........: Yashied ; Modified.......: jpm ; =============================================================================================================================== Func _WinAPI_IsInternetConnected() ;If Not __DLL('connect.dll') Then Return SetError(103, 0, 0) Local $aRet = DllCall('connect.dll', 'long', 'IsInternetConnected') If @error Then Return SetError(@error, @extended, 0) If Not ($aRet[0] = 0 Or $aRet[0] = 1) Then ; not S_OK nor S_FALSE Return SetError(10, $aRet[0], False) EndIf Return Not $aRet[0] EndFunc ;==>_WinAPI_IsInternetConnected 1 Link to post Share on other sites
userdsp 1 Posted July 31, 2015 Author Share Posted July 31, 2015 (edited) Thanx Despo, i will try to use this code! I'm trying to prevent server crashes when master server is dead, so i do this, but maybe there is better way to do it: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=F:\Downloads\Battlefield 3 [ZloEMU V.6.3.X]\Icon.ico #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: userdsp Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <String.au3> #include <Date.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> #include <Array.au3> Opt("WinTitleMatchMode", -1) ; case insensitive, important! Global $iPing, $count, $msgtime, $pingtry, $numhide , $Source, $Source1, $FirstChunks[99],$SecondChunks[99], $test, $sFilePath, $timeC, $players[99] $msgtime = 0 Local $hDLL = DllOpen("user32.dll") Func HIDEchrome() ;====> HotKey WinSetState('Нов раздел - Google Chrome','',@SW_HIDE) EndFunc If Not FileExists(@ScriptDir & '\Launcher.dll') Then MsgBox(64, 'Info', 'Copy me to the game`s foder!') Exit EndIf Func HIDEthescript() ;====> HotKey WinSetState("Battlefield 3™ Server","",@SW_HIDE) WinSetState("ZLOLauncher","",@SW_HIDE) EndFunc HotKeySet( "^+!{F3}", "HIDEthescript") Func SHOWthescript() ;====> HotKey WinSetState("Battlefield 3™ Server","",@SW_SHOW) WinSetState("ZLOLauncher","",@SW_SHOW) WinActivate('Battlefield 3™ Server') WinWaitActive('Battlefield 3™ Server') WinActivate('ZLOLauncher') WinWaitActive('ZLOLauncher') EndFunc HotKeySet( "^+{F3}", "SHOWthescript") Func HideProcon() ;====> HotKey WinSetState("Procon Frostbite","",@SW_HIDE) EndFunc HotKeySet( "^+!{F4}", "HideProcon") Func ShowProcon() ;====> HotKey WinSetState("Procon Frostbite","",@SW_SHOW) WinActivate('Procon Frostbite') WinWaitActive('Procon Frostbite') EndFunc HotKeySet( "^+{F4}", "ShowProcon") Func _TrayTextConn() ; show tray baloons If $FirstChunks[0] <> " list-group-item-danger' lang='en'>Dead " Then TrayTip("", "", 0) If $SecondChunks then TrayTip("", "Zloemu.org ping is " & $iPing & "ms. There is "& $SecondChunks[0] & " server's online and " & $players[0] & " in you'r server.", 5, 1) Else TrayTip("", "", 0) TrayTip("", "Zloemu.org ping is " & $iPing & "ms.", 3, 1) EndIf EndFunc ;==>_TrayText Func _TrayTextConnErr() ; show tray baloons TrayTip("", "", 0) TrayTip("", "Zloemu.org connection lost for " & $count & " count.", 3, 1) EndFunc ;==>_TrayText Func _TrayTextConnLost() ; show tray baloons TrayTip("", "", 0) TrayTip("", "Zloemu.org connection lost for " & $count & " count. Server is closed!", 3, 1) EndFunc ;==>_TrayText Func _TestMainBF3Server() ; show tray baloons $Source = BinaryToString(InetRead('http://zloemu.org', 1)) $FirstChunks = _StringBetween($Source, "class='panel-title' lang='en'>BF3 Status</h3></div><ul class='list-group'><li class='list-group-item", "<span class='badge") If $FirstChunks[0] <> " list-group-item-danger' lang='en'>Dead " Then $SecondChunks = _StringBetween($Source, "Servers online</a> <span class='badge'><a href='http://bf3.zloemu.org/servers'>", "</a></span></li>") $Source1 = BinaryToString(InetRead('http://bf3.zloemu.org/servers', 1)) If $FirstChunks[0] <> " list-group-item-danger' lang='en'>Dead " Then $players = _StringBetween($Source1, "<td>~cemetery~</td><td data-value='", "'>") EndFunc Func _KillBF3Server() $msgtime += 1 WinClose("ZLOLauncher") Sleep(1000) ProcessClose('ZLOLauncher') Sleep(1000) ProcessClose('Battlefield 3™ Server') Sleep(1000) WinClose("Battlefield 3™ Server") Sleep(1000) TrayTip("", "", 0) TrayTip("", "Zloemu.org BF3 MasterServer Status is Dead!", 3, 1) EndFunc While 1 If NOT WinExists("ZLOLauncher") Or NOT WinExists("Battlefield 3™ Server") Then WinClose("ZLOLauncher") WinClose("Battlefield 3™ Server") EndIf Local $iPing = Ping('zloemu.org') If $iPing Then $count = 0 $pingtry += 1 If $pingtry = 1 Then _TrayTextConn() ; $pingtry = 0 If $pingtry = 5 Then _TestMainBF3Server() If $pingtry = 60 Then $pingtry = 0 ; Shows the ping once every minute Else $count += 1 If $count = 10 Then _TrayTextConnErr() ; $pingtryerr = 0 If $count = 100 Then _TrayTextConnLost() ; $pingtryerr = 0 If $count = 101 Then $count = 100 EndIf Sleep(1000) If $count = 100 Then _KillBF3Server() If $FirstChunks[0] == " list-group-item-danger' lang='en'>Dead " Then _KillBF3Server() $sFilePath = FileSaveDialog('Save File', @ScriptDir, '-', 16) $timeC += 1 If $timeC = 1 Then FileWrite($sFilePath & 'serverslots.txt', 'Time: ' & _NowTime() & ' Date : ' & _NowDate() & @CRLF & 'Players: ' & $players[0] & @CRLF) if $timeC = 300 Then $vreme = 0 If NOT WinExists("Battlefield 3™ Server") And NOT WinExists("ZLOLauncher") And $count = 0 And $FirstChunks[0] <> " list-group-item-danger' lang='en'>Dead " Then Do $iPing = Ping("zloemu.org") Sleep(1000) Until $iPing > 0 If $SecondChunks[0] == "0" Then _KillBF3Server() If $SecondChunks[0] <> "0" Then Run('LauncherServer.exe');, '', @SW_SHOW) ; change this path to your own WinActivate('ZLOLAuncher', 'Connect to master') WinWaitActive('ZLOLAuncher', 'Connect to master') Sleep(1000) ;Opt("MouseCoordMode", 2) ;MouseMove(75, 19, 0) ;MouseClick( "primary") ;Sleep(1000) ControlCommand("ZLOLAuncher","[CLASS:TButton;INSTANCE:1]", "", "IsVisible") ControlSend('ZLOLAuncher', '', '[CLASS:TButton; INSTANCE:1]', '{SPACE}') WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Send("{TAB}") Send("{TAB}") Send("Server offline [ " & $msgtime & " ] times") Send("{Enter}") Send("Last Server Boot:") Send("{Enter}") Send(_NowTime()) Send("{Enter}") Send(_NowDate()) Run('_StartServer.bat', '', @SW_MINIMIZE) Sleep(10000) WinActivate("Battlefield 3™ Server") WinWaitActive("Battlefield 3™ Server") EndIf $numhide += 1 If $numhide = 60 Then HIDEthescript() ;=====> hide windows If $numhide = 60 Then $numhide = 0 WEnd ServerLauncherBF3_x64.rar Edited July 31, 2015 by userdsp Link to post Share on other sites
userdsp 1 Posted July 31, 2015 Author Share Posted July 31, 2015 (edited) 32bit version Dont click with mouse button's about a half minute after you start the program to be sure Button 'Connect to Masters' is clicked! ServerLauncherBF3.rar Edited July 31, 2015 by userdsp Link to post Share on other sites
userdsp 1 Posted July 31, 2015 Author Share Posted July 31, 2015 (edited) I update this If statement: If NOT WinExists("Battlefield 3™ Server") And NOT WinExists("ZLOLauncher") And $count = 0 And $FirstChunks[0] <> " list-group-item-danger' lang='en'>Dead " Then Do $iPing = Ping("zloemu.org") Sleep(1000) Until $iPing > 0 If $SecondChunks[0] == "0" Then _KillBF3Server() If $SecondChunks[0] <> "0" Then Run('LauncherServer.exe');, '', @SW_SHOW) ; change this path to your own WinActivate('ZLOLAuncher', 'Connect to master') WinWaitActive('ZLOLAuncher', 'Connect to master') Sleep(300) ;Opt("MouseCoordMode", 2) ;MouseMove(75, 19, 0) ;MouseClick( "primary") WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(300) WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(300) WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(300) WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(300) ControlCommand("ZLOLAuncher","[CLASS:TButton;INSTANCE:1]", "", "IsVisible") ControlSend('ZLOLAuncher', '', '[CLASS:TButton; INSTANCE:1]', '{SPACE}') Sleep(300) Send("{TAB}") Send("{TAB}") Send("Server offline [ " & $msgtime & " ] times") Send("{Enter}") Send("Last Server Boot:") Send("{Enter}") Send(_NowTime()) Send("{Enter}") Send(_NowDate()) Run('_StartServer.bat', '', @SW_MINIMIZE) Sleep(10000) EndIf Edited July 31, 2015 by userdsp Link to post Share on other sites
userdsp 1 Posted August 1, 2015 Author Share Posted August 1, 2015 If NOT WinExists("Battlefield 3™ Server") And NOT WinExists("ZLOLauncher") And $count = 0 And $FirstChunks[0] <> " list-group-item-danger' lang='en'>Dead " Then Do $iPing = Ping("zloemu.org") Sleep(1000) Until $iPing > 0 If $SecondChunks[0] == "0" Then _KillBF3Server() If $SecondChunks[0] <> "0" Then Run('LauncherServer.exe');, '', @SW_SHOW) ; change this path to your own WinActivate('ZLOLAuncher', 'Connect to master') WinWaitActive('ZLOLAuncher', 'Connect to master') Sleep(300) ;Opt("MouseCoordMode", 2) ;MouseMove(75, 19, 0) ;MouseClick( "primary") WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(100) WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(100) WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(100) WinActivate('ZLOLAuncher') WinWaitActive('ZLOLAuncher') Sleep(100) ControlCommand("ZLOLAuncher","[CLASS:TButton;INSTANCE:1]", "", "IsVisible") ControlSend('ZLOLAuncher', '', '[CLASS:TButton; INSTANCE:1]', '{SPACE}') Sleep(1500) Send("{TAB}") Send("{TAB}") Send("Server offline [ " & $msgtime & " ] times") Send("{Enter}") Send("Last Server Boot:") Send("{Enter}") Send(_NowTime()) Send("{Enter}") Send(_NowDate()) Run('_StartServer.bat', '', @SW_MINIMIZE) Sleep(10000) EndIf Link to post Share on other sites
SK-28RUS 34 Posted August 15, 2015 Share Posted August 15, 2015 After a minute of work ... the server is closed and will not start again .. In the task manger hangs the server process (bf3.exe) Link to post Share on other sites
Recommended Posts