В общем вот что у меня получилось:
Код:

$iQueue_Position = _AppSetQueue(500)
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 = 500, $iOnStart = 1)
; Parameters.....: $iWait [Optional] - Wait between each queue check (default is 500 ms).
; $iOnStart [Optional/Internal] - Indicates if the function was executed on start, only internal usage.
;
;
; Return values..: Success - Return Queue position (-1 if this is the first instance of the program).
; Failure - None.
; Author.........: G.Sandler (CreatoR)
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........:
; ===============================================================================================================
Func _AppSetQueue($iWait = 500, $iOnStart = 1)
Local $sUnique_Win, $sQueue, $aQueue, $iC, $sTmp_Script, $nEdit, $hFile, $iLast_Queue
$sUnique_Win = "__Au3_Queue_Window__"
$sQueue = ControlGetText($sUnique_Win, "", "Edit1")
$aQueue = StringSplit($sQueue, @CRLF, 1)
;The script Exits (called by OnAutoItExitRegister)
If Not IsDeclared("iOnStart") Then
$sQueue = ""
$iC = 0
For $i = 1 To $aQueue[0]
If Not StringRegExp($aQueue[$i], '^\d+:' & @AutoItPID) Then
$iC += 1
$sQueue &= $iC & ":" & StringRegExpReplace($aQueue[$i], '^\d+:', '') & @CRLF
EndIf
Next
$sQueue = StringStripWS($sQueue, 3)
ControlSetText($sUnique_Win, "", "Edit1", $sQueue)
Return
EndIf
OnAutoItExitRegister("_AppSetQueue")
If Not WinExists($sUnique_Win) Then
$sTmp_Script = _
'#NoTrayIcon' & @CRLF & _
'GUICreate("' & $sUnique_Win & '", 100, 20)' & @CRLF & _
'$nEdit = GUICtrlCreateEdit("1:' & @AutoItPID & '", 0, 0, 100, 20)' & @CRLF & @CRLF & _
'While GUICtrlRead($nEdit) <> ""' & @CRLF & _
' Sleep(100)' & @CRLF & _
'WEnd' & @CRLF & @CRLF & _
'FileDelete(@TempDir & "\~tmp_GUI_src.tmp")' & @CRLF & _
'Run(@ComSpec & '' /C Del /F /Q "'' & @TempDir & ''\~tmp_GUI.tmp"'', '''', @SW_HIDE)' & @CRLF & _
'Exit' & @CRLF
$hFile = FileOpen(@TempDir & "\~tmp_GUI_src.tmp", 2)
FileWrite($hFile, $sTmp_Script)
FileClose($hFile)
FileCopy(@AutoItExe, @TempDir & "\~tmp_GUI.tmp", 1)
Run(@TempDir & '\~tmp_GUI.tmp /AutoIt3ExecuteScript "' & @TempDir & '\~tmp_GUI_src.tmp"')
Return -1
EndIf
$iLast_Queue = Number(StringRegExpReplace($aQueue[$aQueue[0]], '^(\d+)', '\1'))
$sQueue &= @CRLF & $iLast_Queue + 1 & ":" & @AutoItPID
ControlSetText($sUnique_Win, "", "Edit1", $sQueue)
While 1
$sQueue = ControlGetText($sUnique_Win, "", "Edit1")
$aQueue = StringSplit($sQueue, @CRLF, 1)
If StringRegExp($aQueue[1], '^\d+:' & @AutoItPID) Then
Return $aQueue[0] ;It' our turn in the queue
EndIf
Sleep($iWait)
WEnd
EndFunc