Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; This AHK script will automatically reboot a Star Wars Battlfront 2 server running in GameRanger.
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #singleinstance force ;Forces the script to be replaced by the new one if u try to re run a new instance
- ;#NoTrayIcon
- SetTitleMatchMode, 2
- MANAGER := "ahk_class SWBF2SERVERMANAGER"
- GAMERANGER := "ahk_exe GameRanger.exe"
- MESSAGE := "ATTENTION: The server will now reboot."
- IfWinExist %MANAGER%
- {
- Reboot()
- }
- else
- {
- KillReboot()
- }
- exit
- Reboot()
- {
- global
- ControlClick, Button40, %MANAGER%
- Sleep 5000
- ControlClick, Button1, Question
- Sleep 5000
- ControlClick, Button48, %MANAGER%
- Sleep 5000
- Message()
- Sleep 2000
- ControlClick, Button1, %GAMERANGER%
- Sleep 5000
- ControlClick, Button40, %MANAGER%
- return
- }
- KillReboot()
- {
- global
- Run, %comspec% /c taskkill /f /im BattlefrontII.exe, , hide
- Sleep 5000
- Message()
- Sleep 2000
- ControlClick, Button1, %GAMERANGER%
- Sleep 5000
- ControlClick, Button40, %MANAGER%
- return
- }
- Message()
- {
- global
- ControlClick, RichEdit20W2, %GAMERANGER%
- Clipboard := MESSAGE
- Sleep 100
- ControlSend, RichEdit20W2, ^v, %GAMERANGER%
- Sleep 2000
- ControlSend, RichEdit20W2, {Enter}, %GAMERANGER%
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement