Code: Select all
#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.
DetectHiddenWindows, On
if (A_Args.Count() < 2)
exit("Missing parameter(s). Script will be terminated")
IniRead, hidflag , C:\Users\LAUNCHBOX\Documents\dump\utilities\xpadder-arcade.ini,% A_Args[2], hidhide
IniRead, processName , C:\Users\LAUNCHBOX\Documents\dump\utilities\xpadder-arcade.ini,% A_Args[2], psname
IniRead, k2xflag , C:\Users\LAUNCHBOX\Documents\dump\utilities\xpadder-arcade.ini,% A_Args[2], k2x
If (hidflag = 1) {
RunWait % comspec " /c ""C:\Program Files\Nefarius Software Solutions\HidHide\x64\HidHideCLI.exe""
. --dev-hide ""HID\VID_20A0&PID_41B6&MI_02&Col01\7&f5175f4&0&0000""
. --dev-hide ""HID\VID_D209&PID_0511&MI_00\7&230a7415&0&0000""
. --dev-hide ""HID\VID_D209&PID_0511&MI_02\7&1e117c59&0&0000""
. --dev-hide ""HID\VID_D209&PID_0512&MI_00\7&1204a3a1&0&0000""
. --dev-hide ""HID\VID_D209&PID_0512&MI_02\7&145b94db&0&0000"" "
RunWait % comspec " /c ""C:\Program Files\Nefarius Software Solutions\HidHide\x64\HidHideCLI.exe"" --cloak-on"
}
If (k2xflag = 1) {
Run % "C:\Users\LAUNCHBOX\LaunchBox\ThirdParty\Keyboard2Xinput-1.2.2\Keyboard2XinputGui.exe"
WinWait, ahk_exe Keyboard2XinputGui.exe
Sleep, 2000
}
Run % """C:\Program Files (x86)\Steam\Steam.exe"" -applaunch " . A_Args[1]
isRunning := 0
While (isRunning = 0) { ; Wait until the game is launched
RegRead, isRunning, HKCU\Software\Valve\Steam\Apps\%1%, Running
ToolTip % isRunning
Sleep, 500
}
ToolTip
Process, Wait,% processName ".exe", 3
gamePID := (ErrorLevel) ? ErrorLevel : exit("Unable to locate " processname)
WinActivate, ahk_pid %gamePID%
MouseMove, 1920, 1080
While (isRunning = 1) { ; Wait until the game is closed
RegRead, isRunning,% "HKCU\Software\Valve\Steam\Apps\" . A_Args[1], Running
ToolTip % IsRunning
Sleep, 500
}
ToolTip
; Game stopped, stop keyboard2Xinput by sending numpad multiply key (see k2x mapping.ini)
If (k2xflag = 1) {
SendInput {NumpadMult}
}
If (hidflag = 1) {
RunWait % comspec " /c ""C:\Program Files\Nefarius Software Solutions\HidHide\x64\HidHideCLI.exe""
. --dev-unhide ""HID\VID_20A0&PID_41B6&MI_02&Col01\7&f5175f4&0&0000""
. --dev-unhide ""HID\VID_D209&PID_0511&MI_00\7&230a7415&0&0000""
. --dev-unhide ""HID\VID_D209&PID_0511&MI_02\7&1e117c59&0&0000""
. --dev-unhide ""HID\VID_D209&PID_0512&MI_00\7&1204a3a1&0&0000""
. --dev-unhide ""HID\VID_D209&PID_0512&MI_02\7&145b94db&0&0000"" "
RunWait,% comspec " /c ""C:\Program Files\Nefarius Software Solutions\HidHide\x64\HidHideCLI.exe"" --cloak-off"
}
exit(msg) {
MsgBox % msg
ExitApp
}
JFTR. The Tooltip should provide if your While/RegRead construct is actually delivering any real-time output.
BTw, the script is using the vars %1%/%2% (changed to
A_Args) it looks like it has to be executed via a command line with two parameters!