Skip to content

Instantly share code, notes, and snippets.

@holli-holzer
Last active July 16, 2017 16:08
Show Gist options
  • Save holli-holzer/4c3471b245d593baf1364a67ca35b2aa to your computer and use it in GitHub Desktop.
Save holli-holzer/4c3471b245d593baf1364a67ca35b2aa to your computer and use it in GitHub Desktop.
Launch MWO and automatically skip the start screens, enter the password and login
; mwo-auto-launch
; Version 0.2
;
; by Markus "Tailgunner" Holzer
;
; This script launches the Mechwarrior Online Client
; and eliminates the tedious need to enter your password every time
; to play.
;
; To make it work you will need to edit this script and change some values so it works on your system.
;
; This script must be run as administrator because the program it has to control "remotely"
; needs administrator priviliges itself.
;
; See you on the battlefield Mechwarrior
; This is the password the script uses to login to the MWO-Servers
; change after the =
MWOPassword = Y0urPassword
; This is the directory where the MWOClient.exe is located
; Change the value after the = if your its location is different on your machine
MWODirectory = C:\Program Files\MechWarrior Online\Bin32
; The time the script waits before it presses Esc the first time
MWOStartupTime = 13000
; The time the script waits before it presses Esc again
MWOScreenTime = 2000
; Number of time the script presses Esc before attempting to enter the password
MWOScreenLoops = 3
; Screen coordinates of the "Play" button
MWOPlayButtonXCoord = 780
MWOPlayButtonYCoord = 550
; Check for administrator priviliges
if not A_IsAdmin
{
MsgBox, 48, MWO Auto Launch - Error, This script must be run as administrator.
ExitApp, -1
}
; Start The MWO Client
StartMWO()
{
global MWODirectory
; Indicate Error when the Client is not found
ifExist, %MWODirectory%\MWOClient.exe
{
Run, MWOClient.exe, %MWODirectory%
; Wait for the Client to launch
WinWait, MechWarrior Online,, 20
if ErrorLevel
return 0
return 1
}
return 0
}
; Function to skip the start screens and enter the password
StartPlaying()
{
global MWOPassword
global MWOScreenLoops
global MWOStartupTime
global MWOScreenTime
global MWOPlayButtonXCoord
global MWOPlayButtonYCoord
Sleep, %MWOStartupTime%
; Press Space a few times to skip the loading screen
Loop %MWOScreenLoops% {
Sleep, %MWOScreenTime%
SendInput {Esc}
}
; Type the password
Sleep, %MWOScreenTime%
SendInput %MWOPassword%
; Click login
Click %MWOPlayButtonXCoord%, %MWOPlayButtonYCoord%
}
if ( StartMWO() )
{
StartPlaying()
}
else
{
MsgBox, 48, MWO Auto Launch - Error, Could not start or find the client. Make sure the MWO directory is set correctly.
ExitApp, -2
}
; Exit indicating success
Exit, 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment