#include <Misc.au3>
Opt("WinTitleMatchMode", 1)
;Parsing
Local $count = StringInStr($CmdLineRaw, ".exe", 0 , 1, 1)
local $app = StringLeft ( $CmdLineRaw, $count + 4 )
local $command = StringTrimLeft( $CmdLineRaw, $count + 4 )
if not $command then exit 0
HotKeySet("{ESC}", "Terminate")
$PID = Run ('"' & $app & '" ' & $command)
;wait for emul start to hide cursor
WinWaitActive ( "gpu" )
Send("!{ENTER}")
_MouseTrap(@DesktopWidth, @DesktopHeight, @DesktopWidth, @DesktopHeight)
While ProcessExists ( $PID )
sleep(500)
WEnd
Exit 0
;functions
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc