SBrown Posted September 26, 2008 Share Posted September 26, 2008 (edited) How can I make an if then loop that will check an array first, without having to type it all out? Dim $badwinnames[2] $badwinnames[0] = "Default IME" $badwinnames[1] = "Program Manager" If $winlist[$i][0] <> $badwinnames Then <<DO OTHER STUFF HERE>> EndIf I'm trying to make a list of windows that are in the taskbar Edited September 26, 2008 by SBrown Link to comment Share on other sites More sharing options...
martin Posted September 26, 2008 Share Posted September 26, 2008 How can I make an if then loop that will check an array first, without having to type it all out? Dim $badwinnames[2] $badwinnames[0] = "Default IME" $badwinnames[1] = "Program Manager" If $winlist[$i][0] <> $badwinnames Then <<DO OTHER STUFF HERE>> EndIf I'm trying to make a list of windows that are in the taskbarI think you mean Dim $badwinnames[2] $badwinnames[0] = "Default IME" $badwinnames[1] = "Program Manager" If $winlist[$i][0] <> $badwinnames[0] And $winlist[$i][0] <> $badwinnames[1] Then <<DO OTHER STUFF HERE>> EndIf Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
SBrown Posted September 27, 2008 Author Share Posted September 27, 2008 I think you mean Dim $badwinnames[2] $badwinnames[0] = "Default IME" $badwinnames[1] = "Program Manager" If $winlist[$i][0] <> $badwinnames[0] And $winlist[$i][0] <> $badwinnames[1] Then <<DO OTHER STUFF HERE>> EndIf Thats what i ment, however my array will have like 100 different window names, so an ifthen loop with $winlist[$i][0] <> $badwinnames[0] And $winlist[$i][0] <> $badwinnames[1] And $winlist[$i][0] <> $badwinnames[3]... will be counterproductive. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 27, 2008 Share Posted September 27, 2008 Why don't you use a loop? (pseudocode) for $x to ubound($badwinnames)-1 If $winlist[$i][0] <> $badwinnames[$x] then;do something next .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
SBrown Posted September 27, 2008 Author Share Posted September 27, 2008 (edited) Because it is already in a loop for $winlist. I have redesigned the code now While 1 $awin = getawin(0) if $awin = "" OR $awin = "0" OR $awin = "Program Manager" OR $awin = "Start Menu" Then tooltip("~ Program Disable ~", 0,0); HIDE PROGRAM CODE HERE Else tooltip($awin, 0,0); SHOW PROGRAM CODE HERE EndIf WEnd func getawin($window) $winlist = winlist() For $l = 1 to $winlist[0][0] if checkwin($winlist[$l][1]) Then Return $winlist[$l][0] EndIf Next EndFunc func checkwin($w) If BitAnd( WinGetState($w), 1) AND BitAnd( WinGetState($w), 2) AND BitAnd( WinGetState($w), 4) AND BitAnd( WinGetState($w), 8) AND NOT BitAnd( WinGetState($w), 16) Then Return 1 Else Return 0 EndIf EndFunc Feel free to use and or improve. BTW This is for my GridMan 4.0GridMan.zip Edited September 27, 2008 by SBrown 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