#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.

#WinActivateForce ; Prevents taskbar flicker on certain systems.

#Warn ; Enable warnings to assist with detecting common errors.

#SingleInstance ; Prevent more than one instance from being made.

SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

loop

{

GetCentreMousePosX := ( A_ScreenWidth // 2 )

GetCentreMousePosY := ( A_ScreenHeight // 2 )

if ( WinExist ( "Dewrito RCON Controller" ) ) ; RabidSquabbit's RCON Controller

{

RconTitle := "Dewrito RCON Controller"

WinActivate , %RconTitle%

WinMaximize , %RconTitle%

Click %GetCentreMousePosX% , %GetCentreMousePosY%

Send ^ l ; "Ctrl + L" emulates a keyboard shortcut to access the Address Bar.

Sleep , 1000 ; Prevents the next send command from randomly cutting off the text (On some browsers (Chrome) a lower delay will cause the text to input incorrectly, on others (Midori) as low as 1ms is fine.

Send , javascript:document . getElementsByClassName ( "form-control" ) . item ( "rconCommand" ) . focus ( ) { enter } ; Set Focus to the Rcon TextBox.

Send , list { enter }

; Reverts the URL back to the correct web address, for Web Browsers that don't do that automatically [i.e. Midori].

Send ^ l

Sleep , 1000 ; See line 19

Send , https: // rabidsquabbit . github . io ; Sets the address bar back to the original URL.

Send , { Esc } ; Escapes the AutoComplete submenu that some Web Browsers utilise [i.e Midori].

Sleep , 59000 ; 59 seconds + Sleep timer from line 19.

}

else if ( WinExist ( "Dewcon" ) ) ; FishPhD's RCON Controller

{

RconTitle := "Dewcon"

WinActivate , %RconTitle%

WinMaximize , %RconTitle%

Click %GetCentreMousePosX% , %GetCentreMousePosY%

Send { Tab 2 } ; Set focus to textbox

Send , list { enter }

Sleep , 60000

}

}

Pause :: Pause ; Pauses the Script.

Del :: ExitApp ; Closes the Script, DO NOT set to Escape (see Line 20).

^ #:: ; "Ctrl + #" Sets the RDP to Console mode, this will allow the user to close the RDP session and keep the script running

{

Send , { LWin down } d { LWin up }

Run , cmd . exe

Sleep , 1000

Send , tscon 2 / dest:console { enter }

WinActivate , %RconTitle%

WinMaximize , %RconTitle%

Click %GetCentreMousePosX% , %GetCentreMousePosY%

WinClose , ahk_exe cmd . exe