; If the script is not elevated, relaunch as administrator and kill current instance:
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try ; leads to having the script re-launching itself as administrator
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
SetWorkingDir %A_ScriptDir%
Sleep, 15000
startbot:
loop *.exe
{
if(A_LoopFileName!="cports.exe") And (A_LoopFileName!="startbot.exe")
{
Run, %A_LoopFileName% --normal, , , ebpid
}
}
WinWait ahk_pid %ebpid%
WinActivate ahk_pid %ebpid%
WinGetActiveTitle, ebtitle
SendMessage, 0xB772,,,, %ebtitle%
Loop {
Process, Exist, %ebpid%
If ErrorLevel = 0
{
Sleep, 10000
WinGet, ebbpid, PID, ahk_class #32770
Process, Close, %ebbpid%
Goto, startbot
}
}
Save this text to file whatever.ahk and copy to startup folder. Win+r type shell:startup
Script run bot after 15 seconds(for all vpn, proxyfier etc loads)
Script autostart bot with last used profile
Script watch if bot crashed or relaunch and stuck on inject method window then script relaunch bot and autostart it. Check every 10 seconds.
I use it inside my vmware box