Don't like ads? PRO users don't see any ads ;-)

Process Get Windows

By: name22 on Jun 9th, 2012  |  syntax: AutoIt  |  size: 0.65 KB  |  hits: 70  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <Array.au3>
  2. #include <Process.au3>
  3.  
  4. GUICreate("Test1", 100, 100)
  5. GUICreate("Test2", 100, 100)
  6. GUICreate("Test3", 100, 100)
  7. GUICreate("Test4", 100, 100)
  8. GUISetState()
  9.  
  10. $aResult = _ProcessGetWindows("Autoit3.exe")
  11. _ArrayDisplay($aResult)
  12.  
  13. Func _ProcessGetWindows($sProcessName)
  14.         $aWinList = WinList()
  15.         $sWindowsFound = ""
  16.         For $i = 1 To $aWinList[0][0]
  17.                 If _ProcessGetName(WinGetProcess($aWinList[$i][0])) = $sProcessName And $aWinList[$i][0] <> "" Then $sWindowsFound &= $aWinList[$i][0] & '|'
  18.         Next
  19.         If $sWindowsFound = "" Then Return -1
  20.         Return StringSplit(StringTrimRight($sWindowsFound, 1), "|", 2)
  21. EndFunc   ;==>_ProcessGetWindows