2012-07-18, 20:38
Hi, my new script (auto it) for steam (he works), you have juste to name your *.url like the name of your titles games, and don't use the fullscreen option by the plugin advance launcher.
Code:
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
HotKeySet("{ESC}", "Terminate")
HotKeySet("!{F4}", "Terminate")
If $CmdLine[0] == 1 Then
Run("nomousy.exe /hide", "", @SW_HIDE)
Run("pssuspend XBMC.exe", "", @SW_HIDE)
ShellExecute($CmdLine[1])
Local $array = StringSplit($CmdLine[1], '\')
Local $file = $array[$array[0]]
Local $nameSplit = StringSplit($file, '.', 1)
Local $name = $nameSplit[1]
$hWnd = WinGetHandle($name)
$vPID = 0;
;~ Sleep(2000)
WinWaitActive($name)
local $Client = WinList($name) ; All Process
;~ MsgBox(64, "te" ,"Debug: " & $Client[0][0] & @LF ) ; How many copies are running
For $i = 1 to $Client[0][0] ; do for each copy
;~ MsgBox(64,"","Debug " & $i & ",0 : " & $Client[$i][0] & @LF ) ; window title
;~ MsgBox(64,"","Debug " & $i & ",1 : " & $Client[$i][1] & @LF ) ; window handle
$hWnd = $Client[$i][1]
Next
If WinExists($hWnd) Then
$vPID = WinGetProcess($hWnd)
If @error Then
$vPID = -1;
EndIf
EndIf
While ($vPID > 0)
$vPID = ProcessExists($vPID)
Sleep(100)
WEnd
Terminate()
EndIf
Func Terminate()
Run("nomousy.exe", "", @SW_HIDE)
Run ( "nircmd win max process XBMC.exe" )
Run("pssuspend -r XBMC.exe", "", @SW_HIDE)
WinWaitActive ("XBMC")
Exit 0
EndFunc