Sign in to follow this  
Followers 0
SleepyXtreme

searching WinList()

8 posts in this topic

I was wondering if anyone has a good method for searching WinList() for window names. cause i keep trying with all sorts of methods and none are working.

Basically, i want to do the following:

$List=WinList()
$Exceptions[1]= "Internet Explorer"
$Exceptions[2] = "AIM"
$Exceptions[3] = "Windows"
$Exceptions[4] = "Firefox"
$Exceptions[5] = "word"
$Exceptions[0] = 5

For $y = 1 to $List[0][0]
     For $x = 1 to $Exceptions[0]
          if $Exceptions[$x] = $List[$y][0] then
              $List[$y][0] = ""
          Endif
     Next
Next

I've tried this many different ways and i can't get anything to work. Can anyone actual code this to work or maybe have a better idea?

any help would be appreciated, thanks

Share this post


Link to post
Share on other sites



I was wondering if anyone has a good method for searching WinList() for window names. cause i keep trying with all sorts of methods and none are working.

Basically, i want to do the following:

$List=WinList()
$Exceptions[1]= "Internet Explorer"
$Exceptions[2] = "AIM"
$Exceptions[3] = "Windows"
$Exceptions[4] = "Firefox"
$Exceptions[5] = "word"
$Exceptions[0] = 5

For $y = 1 to $List[0][0]
     For $x = 1 to $Exceptions[0]
          if $Exceptions[$x] = $List[$y][0] then
              $List[$y][0] = ""
          Endif
     Next
Next
oÝ÷ Øý½ëkçm+&j|÷Þ­éíÁ¬¬jwbq©÷öص©ò¶§Ú0¢¹jv§ÊÞiËnjW(uëaËhÂ䢹ɷ¡j÷mëmz¸y¦§Ê¥§
.ÖÞjkyȵçm©ä³ú®¢×¢^Å©©è§éi~)^jëh×6
$var = WinList()

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  EndIf
Next

Share this post


Link to post
Share on other sites

I was wondering if anyone has a good method for searching WinList() for window names. cause i keep trying with all sorts of methods and none are working.

Basically, i want to do the following:

$List=WinList()
$Exceptions[1]= "Internet Explorer"
$Exceptions[2] = "AIM"
$Exceptions[3] = "Windows"
$Exceptions[4] = "Firefox"
$Exceptions[5] = "word"
$Exceptions[0] = 5

For $y = 1 to $List[0][0]
     For $x = 1 to $Exceptions[0]
          if $Exceptions[$x] = $List[$y][0] then
              $List[$y][0] = ""
          Endif
     Next
Next
oÝ÷ Øý½ëkçm+&j|÷Þ­éíÁ¬¬jwbq©÷öص©ò¶§Ú0¢¹jv§ÊÞiËnjW(uëaËhÂ䢹ɷ¡j÷mëmz¸y¦§Ê¥§
.ÖÞjkyȵçm©ä³ú®¢×¢YhÂ)àÂäy×è®gê'xg§z¶­¢¹Ø¨çb²èm¦åɦ޶׫²n¶*'.®¶­s`¤FÒb33c´W6WFöç5³eÐ ¢b33c´Æ7CÕväÆ7B ¢b33c´W6WFöç5³ÒÒgV÷C³RgV÷C°¢b33c´W6WFöç5³ÒÒgV÷C´F÷væÆöG2gV÷C°¢b33c´W6WFöç5³%ÒÒgV÷C´ÒgV÷C°¢b33c´W6WFöç5³5ÒÒgV÷CµvæF÷w2gV÷C°¢b33c´W6WFöç5³EÒÒgV÷C·6V&6ærväÆ7BÒWFôBf÷'V×2ÒÖ÷¦ÆÆf&Vf÷gV÷C°¢b33c´W6WFöç5³UÒÒgV÷C·v÷&BgV÷C°  ¤f÷"b33c·ÒFòb33c´Æ7E³Õ³Ð¢f÷"b33c·ÒFòT&÷VæBb33c´W6WFöç2ÂÒ¢bb33c´W6WFöç5²b33c·ÒÒb33c´Æ7E²b33c·Õ³ÒFVà 6öç6öÆUw&FRgV÷C´ÖF6f÷VæC¢gV÷C²fײb33c´W6WFöç5²b33c·ÒfײÄb¢VæD`¢æW@¤æW@

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

i'm confused. generator just showed me the example in the help file but it still doesn't help me when it comes to exceptions.......

edit:

that code didn't work for me fu2m8.

the consolewrite thing wrote nothing 30 times

Edited by SleepyXtreme

Share this post


Link to post
Share on other sites

i'm confused. generator just showed me the example in the help file but it still doesn't help me when it comes to exceptions.......

edit:

that code didn't work for me fu2m8.

the consolewrite thing wrote nothing 30 times

If StringInStr($List[$y][0], $Exceptions[$x]) And BitAnd(WinGetState($List[$y][1]), 2) Then

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Try not using '=' for complete match, since your list doesn't look like full window names:

; If $Exceptions[$x] = $List[$y][0] then
If StringInStr($List[$y][0], $Exceptions[$x]) then

:)

Edit: Doh! The SmOke_N answer-bot beat me to it!

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

funny thing is, i beat you both to it cause i just realized that's what i had to do and i just checked the thread. here's the final product:

Func Exceptions()
    msgbox(0,"Exceptions","Exceptions are on")
    $Exceptions[0] = "30"
    $Exceptions[1] = "Downloads"
    $Exceptions[2] = "AIM"
    $Exceptions[3] = "Windows"
    $Exceptions[4] = "searching WinList() - AutoIt Forums"
    $Exceptions[5] = "word"
    $Exceptions[6] = "internet"
    For $y = 1 to $WindowList[0][0]
        For $x = 1 to UBound($Exceptions, 1) - 1
            If StringInStr($WindowList[$y][0], $Exceptions[$x]) > 0 then
                    ConsoleWrite("Match found: " & $Exceptions[$x] & @LF)
                    $WindowList[$y][0] = ""
            EndIf
        Next
    Next 
EndFunc

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

funny thing is, i beat you both to it cause i just realized that's what i had to do and i just checked the thread. here's the final product:

FYI

StringInStr returns an integer/boolean type.

So:

StringInStr($WindowList[$y][0], $Exceptions[$x]) > 0

> 0 is not necessary in that condition statement.

Also, I took the assumption that you are in some way going to interact with these windows, so I made sure they were visible during the check.

If this is the case, you may want to look more at using the handle returned after the StringInStr() rather than the window name (Unless of course that holds answers to other parts of your script).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0