#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\..\..\..\..\Медиа\Изображения\1.ico
#AutoIt3Wrapper_Outfile_x64=D:\Scripts\Run.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WinAPIProc.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>
If WinExists(@ScriptName) Then Exit
AutoItWinSetTitle(@ScriptName)
$Punto = _ProcsExit('punto.exe')
$RunMe = _ProcsExit('RunMe.exe')
If ProcessExists('myprog.exe') Then
ShellExecute('c:\Program Files (x86)\Stylus\stylus.exe', '', 'c:\Program Files (x86)\Stylus\')
ProcessWaitClose('myprog.exe')
Run('d:\Programs\Punto Switcher\punto.exe')
Run('d:\Programs\RunMe\RunMe.exe')
Else
ShellExecute('c:\Program Files (x86)\Stylus\stylus.exe', '', 'c:\Program Files (x86)\Stylus\')
;~ _WinAPI_PostMessage($title,$WM_CLOSE,0,0)
ProcessWait('myprog.exe')
ProcessWaitClose($Punto)
ProcessWaitClose($RunMe)
ProcessWaitClose('myprog.exe')
Run('d:\Programs\Punto Switcher\punto.exe')
Run('d:\Programs\RunMe\RunMe.exe')
EndIf
Exit
Func _ProcsExit($iProc)
$iPID = ProcessWait($iProc)
$aProcWindows = _WinAPI_EnumProcessWindows($iPID, False)
If @error Then
;ProcessClose($iPID)
Else
For $i = 1 To $aProcWindows[0][0]
_WinAPI_PostMessage($aProcWindows[$i][0], $WM_CLOSE, 0, 0)
Next
EndIf
EndFunc