[..] Winlist() with different items

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Répondre
camilla
Niveau 1
Niveau 1
Messages : 4
Enregistré le : lun. 03 févr. 2014 22:49
Status : Hors ligne

[..] Winlist() with different items

#1

Message 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
Modifié en dernier par jguinch le mar. 04 févr. 2014 11:16, modifié 1 fois.
Raison : Mise en conformité du titre
Avatar du membre
Tlem
Site Admin
Site Admin
Messages : 11818
Enregistré le : ven. 20 juil. 2007 21:00
Localisation : Bordeaux
Status : Hors ligne

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

#2

Message 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). ;)
Thierry

Rechercher sur le forum ----- Les règles du forum
Le "ça ne marche pas" est une conséquence commune découlant de beaucoup trop de raisons potentielles ...

Une idée ne peut pas appartenir à quelqu'un. (Albert Jacquard) tiré du documentaire "Copié n'est pas volé".
Avatar du membre
mikell
Spammer !
Spammer !
Messages : 6292
Enregistré le : dim. 29 mai 2011 17:32
Localisation : Deep Cévennes
Status : Hors ligne

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

#3

Message 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
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
camilla
Niveau 1
Niveau 1
Messages : 4
Enregistré le : lun. 03 févr. 2014 22:49
Status : Hors ligne

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

#4

Message par camilla »

mrc terri i was thinking to Put the classnames in an array and loop WinList. will this work ?
camilla
Niveau 1
Niveau 1
Messages : 4
Enregistré le : lun. 03 févr. 2014 22:49
Status : Hors ligne

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

#5

Message par camilla »

mikell thank you very much this is what i was trying to do :D
Avatar du membre
mikell
Spammer !
Spammer !
Messages : 6292
Enregistré le : dim. 29 mai 2011 17:32
Localisation : Deep Cévennes
Status : Hors ligne

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

#6

Message par mikell »

Nice, but don't forget to store the pids too if you plan to resume them later
► Afficher le texte
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
camilla
Niveau 1
Niveau 1
Messages : 4
Enregistré le : lun. 03 févr. 2014 22:49
Status : Hors ligne

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

#7

Message par camilla »

thank you for your great help you'r the Boss :wink:
Répondre