Page 1 sur 1

[..] Winlist() with different items

Posté : lun. 03 févr. 2014 23:10
par camilla
hello everybody, i need your help please. this is my code and i will explain my problem in it

Code : Tout sélectionner

#include <MsgBoxConstants.au3>
Example()
Func Example()

    ; Retrieve a list of window handles.
     Local $aList = WinList("[class:PROCEXPL]")
 ; Loop through the array displaying only visable windows with a title.
    For $i = 1 To $aList[0][0]
        If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then
          $vv = WinGetProcess($aList[$i][1])
         MsgBox(0,"",""&$vv)

        EndIf
    Next
 EndFunc
i want to get the process of more than one application ,but i want to specific the app

in my code i specified the "[class:PROCEXPL]" and i get its PID but i need to specify more than one app like this

Code : Tout sélectionner

 Local $aList = WinList("[class:PROCEXPL]" and "[class:MozillaWindowClas]" and "[class:PiriformCCleaner]" )
so my code will show me the PID of those applications only , but this dosen't work

thank you in advance

Re: [..] ....winlist() with different items

Posté : lun. 03 févr. 2014 23:30
par Tlem
Hi camilla, I think that REGEXPCLASS can help you with a correct pattern. ;)

Another way is to get the list of all windows with Winlist and to use a loop to control the class type of each window (WinGetClassList).
_WinAPI_EnumWindows can retreave handle and class name in one time (but need an include). ;)

Re: [..] ....winlist() with different items

Posté : lun. 03 févr. 2014 23:37
par mikell
Otherwise you can store the classes in an array and loop inside as Tlem said
Assuming that your question is related to the one you asked on the US forum, maybe this will do what you want

Code : Tout sélectionner

Local $hWnd[3] = ["[class:Notepad]", "[class:Chrome_WidgetWin_1]", "[class:MozillaWindowClass]"]

For $i = 0 to 2
   If WinExists($hWnd[$i]) Then
      $vPID = WinGetProcess($hWnd[$i])
      _ProcessSuspend($vPID)
   EndIf
Next

Re: [..] ....winlist() with different items

Posté : lun. 03 févr. 2014 23:38
par camilla
mrc terri i was thinking to Put the classnames in an array and loop WinList. will this work ?

Re: [..] ....winlist() with different items

Posté : lun. 03 févr. 2014 23:40
par camilla
mikell thank you very much this is what i was trying to do :D

Re: [..] ....winlist() with different items

Posté : mar. 04 févr. 2014 00:07
par mikell
Nice, but don't forget to store the pids too if you plan to resume them later
► Afficher le texte

Re: [..] ....winlist() with different items

Posté : mar. 04 févr. 2014 10:44
par camilla
thank you for your great help you'r the Boss :wink: