Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; This AHK script will automatically restart a Star Wars Battlfront 2 game using the Chat Reader and Admin Commander.exe.
- #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
- IP := "127.0.0.1"
- PORT := "4658"
- PASS := "YOURPASS"
- PROCESS := "ahk_exe Chat Reader and Admin Commander.exe"
- PROCESS_DIR := "C:\Misc\Programs\Chat Reader and Admin Commander"
- MESSAGE := "/say ATTENTION: The game will now restart."
- ADMIN_COMMAND := "/restart"
- IfWinNotExist %PROCESS%
- {
- Start()
- Sleep 5000
- Command()
- }
- else
- {
- Command()
- }
- exit
- Start()
- {
- global
- Run, Chat Reader and Admin Commander.exe, %PROCESS_DIR%
- Sleep 5000
- ControlSend, Edit2, %IP%, %PROCESS%
- ControlSend, Edit3, %PORT%, %PROCESS%
- ControlSend, Edit4, %PASS%, %PROCESS%
- Sleep 2000
- ControlClick, Button1, %PROCESS%
- return
- }
- Command()
- {
- global
- Clipboard := MESSAGE
- Sleep 100
- ControlSend, Edit6, ^v, %PROCESS%
- ControlClick, Button3, %PROCESS%
- Sleep 5000
- ControlSend, Edit6, %ADMIN_COMMAND%, %PROCESS%
- ControlClick, Button3, %PROCESS%
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement