Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.66 KB | None | 0 0
  1. #include <array.au3>
  2. #include <Process.au3>
  3. $list = ProcessList()
  4. For $i = 1 To $list[0][0]
  5. MsgBox(0,"",_WinGetByPID($list[$i][1]))
  6.  
  7. Next
  8.  
  9. Func _WinGetByPID($iPID, $nArray = 0)
  10.     If IsString($iPID) Then $iPID = ProcessExists($iPID)
  11.     Local $aWList = WinList(), $sHold
  12.     For $iCC = 1 To $aWList[0][0]
  13.         If WinGetProcess($aWList[$iCC][1]) = $iPID And _
  14.             BitAND(WinGetState($aWList[$iCC][1]), 2) Then
  15.             If $nArray Then Return $aWList[$iCC][0]
  16.             $sHold &= $aWList[$iCC][0] & Chr(1)
  17.         EndIf
  18.     Next
  19.     If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
  20.     Return SetError(1, 0, 0)
  21. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement