Hello,
try this,
; Check if a parameter was provided
if 0 < 1
{
MsgBox, No .exe file specified as a parameter.
ExitApp
}
; Get the first command-line parameter (game path)
game = %1%
; Extract the EXE file name
SplitPath, game, , , , gameExe
; Ensure .exe extension is present
if (SubStr(gameExe, -4) != ".exe")
{
gameExe .= ".exe"
}
; Launch the game
Run, "%game%", , , PID_Game
; If the launch fails
if (ErrorLevel)
{
MsgBox, Failed to launch the game. Check if the path is correct.
ExitApp
}
; Wait for the game process to appear
Sleep, 3000
Loop
{
Process, Exist, %gameExe%
if (ErrorLevel)
break
Sleep, 1000
}
; If process never shows up
if !ErrorLevel
{
MsgBox, The process %gameExe% was not detected. Check the file name.
ExitApp
}
; Wait until game process exits
Loop
{
Process, Exist, %gameExe%
if (!ErrorLevel)
break
Sleep, 1000
}
Sleep, 2000
; Hide EA Desktop when game closes
WinHide, ahk_exe EADesktop.exe
ExitApp
this is v1 autohotkey file, i have it as ahk not exe and it works but autohotkey must be installed in order for this to execute,
create a new emulator call it what ever you want, eg, EA Launcher, Application Path point it to the ahk file, then in any game use emulator and choose the one you created EA Launcher for example.
I have attached the file ready to use if you want.
Regards.
MinimizeEA.ahk