Sign in to follow this  
Followers 0
SBrown

Array Help

5 posts in this topic

#1 ·  Posted (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 by SBrown

Share this post


Link to post
Share on other sites



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

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

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (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.0

GridMan.zip

Edited by SBrown

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