У AutoIt есть встроенное (скрытое) окно, его и использует моя функция.
Цитата mitiya:
самое главное они запускаются на терминальном сервере, и в результате скрпты всех пользователей в очередь встают, а надо чтоб очередь создавалась у каждого пользователя своя »
|
Вот это «самое главное» следует указывать в самом начале, при созданий темы.
Можно попробовать так:
Код:

#include "WinAPIEx.au3" ;http://autoit-script.ru/index.php/topic,47.0.html
$iQueue_Position = _AppSetQueue(100)
MsgBox(64, 'Title', StringFormat('Process: %i\nQueue position: %i', @AutoItPID, $iQueue_Position))
; #FUNCTION# ====================================================================================================
; Name...........: _AppSetQueue
; Description....: Sets Queue for the next instances of this script.
; Syntax.........: _AppSetQueue($iWait = 100, $sUserName = @UserName)
; Parameters.....: $iWait [Optional] - Waiting queue (default is 100 ms).
; $sUserName [Optional] - Limit queue for specfific system user.
;
;
; Return values..: Success - Return Queue position (0 if this is the first instance of the program).
; Failure - None.
;
; Author.........: G.Sandler (CreatoR)
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........:
; ===============================================================================================================
Func _AppSetQueue($iWait = 100, $sUserName = @UserName)
Local $sUnique_Win, $sScriptName, $aProcList, $aWinList, $iQueue, $hPrev_Queue_Win, $aProcUser
$sUnique_Win = "_Au3_Queue_Window_"
$sScriptName = @ScriptName
If Not @Compiled Then
$sScriptName = StringRegExpReplace(@AutoItExe, '^.*\\', '')
EndIf
$aProcList = ProcessList($sScriptName)
$aWinList = WinList($sUnique_Win)
$iQueue = 0
$hPrev_Queue_Win = 0
If UBound($aWinList) > 1 Then
$hPrev_Queue_Win = $aWinList[1][1]
EndIf
For $i = 1 To UBound($aProcList)-1
$aProcUser = _WinAPI_GetProcessUser($aProcList[$i][1])
If $aProcUser[0] <> $sUserName Then
ContinueLoop
EndIf
For $j = 1 To UBound($aWinList)-1
If $aWinList[$j][0] = $sUnique_Win And WinGetProcess($aWinList[$j][1]) = $aProcList[$i][1] Then
$iQueue += 1
If $j > 1 Then
$hPrev_Queue_Win = $aWinList[$j-1][1]
EndIf
ExitLoop
EndIf
Next
Next
AutoItWinSetTitle($sUnique_Win & "__")
ControlSetText($sUnique_Win & "__", "", "Edit1", $iQueue + 1)
AutoItWinSetTitle($sUnique_Win)
If $iQueue = 0 Then
Return 0
EndIf
While WinExists($hPrev_Queue_Win)
Sleep($iWait)
WEnd
Return $iQueue
EndFunc
нужно подключить библиотеку
WinAPIEx.au3.