SleepyXtreme Posted June 1, 2007 Share Posted June 1, 2007 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 Link to comment Share on other sites More sharing options...
Generator Posted June 1, 2007 Share Posted June 1, 2007 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 Link to comment Share on other sites More sharing options...
fu2m8 Posted June 1, 2007 Share Posted June 1, 2007 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@ Link to comment Share on other sites More sharing options...
SleepyXtreme Posted June 1, 2007 Author Share Posted June 1, 2007 (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 June 1, 2007 by SleepyXtreme Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 1, 2007 Moderators Share Posted June 1, 2007 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 timesIf 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. Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 1, 2007 Share Posted June 1, 2007 (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 June 1, 2007 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 Link to comment Share on other sites More sharing options...
SleepyXtreme Posted June 1, 2007 Author Share Posted June 1, 2007 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 1, 2007 Moderators Share Posted June 1, 2007 (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 June 1, 2007 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now