Auto Start Server

07/24/2013 04:15 yangc10#1
Just thought I share my little code to auto start your server. One thing does comes in mind is my coordinates might be different than yours. You can also customize these codes to your needs. Don't forget to compile with autoit.

Note that you'll have to open Certification manually as autoit doesn't open it as expected. Always gives me an error. Once saved; toss these two codes inside the server folder then make OpenServer.exe as short-cut to desktop. OpenServer.exe will call out to GSDown.exe.

OpenServer.exe
Open Server
Code:
OpenServer()

Func OpenServer()
ShellExecute("GlobalManager.exe", @WorkingDir)
sleep(2000)
ShellExecute("MachineManager.exe", @WorkingDir)
sleep(2000)
ShellExecute("GatewayServer.exe", @WorkingDir)
sleep(2000)
ShellExecute("DownloadServer.exe", @WorkingDir)
sleep(2000)
ShellExecute("FarmManager.exe", @WorkingDir)
sleep(2000)
ShellExecute("SR_ShardManager.exe", @WorkingDir)
sleep(2000)
ShellExecute("AgentServer_no_xtrap.exe", @WorkingDir)
sleep(2000)
ShellExecute("SR_GameServer.exe", @WorkingDir)
sleep(15000)
_Opensmc()
EndFunc

Func _Opensmc()
ShellExecute("smc_independent.exe", @WorkingDir) ;open and run smc
WinActivate("[CLASS:#32770]","")
sleep(1000)
send("YOURUSERNAME")
sleep(1000)
send("{TAB}")
sleep(1000)
send("YOURPASSWORD")
send("{ENTER}")
sleep(1000)
SMC()
EndFunc

Func SMC()
WinActivate("[CLASS:SMC]","") ;can't combine with class32770 smc
mouseclick("LEFT", 332,80, 1)
sleep(500)
MouseClick("LEFT", 329,103, 1)
sleep(15000)
Mouseclick("LEFT", 640, 101, 1)
sleep(3000)
Mouseclick("LEFT", 478, 132, 1)
sleep(500)
MouseClick("LEFT", 669, 132, 1)
sleep(500)
MouseClick("LEFT", 1097,130, 1)
sleep(300000)
MouseClick("RIGHT", 328, 210, 1) ;start Global and up
sleep(1000)
MouseClick("LEFT", 382, 305, 1)
sleep(500)
send("{ENTER}")
sleep(3000)
Mouseclick("RIGHT", 519, 216, 1) ; start Agent and up
sleep(1000)
MouseClick("LEFT", 563,309, 1)
sleep(500)
Send("{Enter}")
ShellExecute("GSDown.exe", @WorkingDir) ;open and run smc
Exit
EndFunc
GSDOWN.exe
OPEN SR_GameServer if it closed
Code:
HotKeySet("{ESC}", "_Quit")

Main()

Func Main()
While 1
	WinWait("[CLASS:SR_GameServer]")
	WinWaitClose("[CLASS:SR_GameServer]")
	Run("SR_GameServer.exe", @WorkingDir)
	Sleep(145000)
	CloseHim()
WEnd
EndFunc

Func _Quit()
	Exit
EndFunc

Func CloseHim()
If WinExists("[CLASS:#32770]","") Then 
   WinActivate("[CLASS:#32770]","")
   sleep(1000)
   MouseClick("LEFT", 869, 362, 1)
   SMC()
Else
   SMC()
EndIf
EndFunc

Func SMC()
WinActivate("[CLASS:SMC]","") ;can't combine with class32770 smc
sleep(5000)
MouseClick("RIGHT", 328, 210, 1) ;start Global and up
sleep(1000)
MouseClick("LEFT", 382, 305, 1)
sleep(500)
send("{ENTER}")
sleep(3000)
Mouseclick("RIGHT", 519, 216, 1) ; start Agent and up
sleep(1000)
MouseClick("LEFT", 563,309, 1)
sleep(500)
Send("{Enter}")
Main()
EndFunc
Like if you think it helped you!:D
07/24/2013 13:18 PortalDark#2
#approved