Jump to content

differentiate a button from a pressed button


Recommended Posts

ok i try this here

but it cant see if is checked

CODE
WinActivate("Checker v1.0.3")

WinWaitActive("Checker v1.0.3")

ControlFocus("Checker v1.0.3", "", "TButton3")

If(ControlCommand( "Checker v1.0.3", "", "[CLASS:TButton; INSTANCE:3]", "IsChecked", "") == 1) Then

MsgBox(0, "", "one is checked")

ElseIf(ControlCommand( "Checker v1.0.3", "", "[CLASS:TButton; INSTANCE:3]", "IsChecked", "") == 0) Then

MsgBox(0, "", "one is NOT checked")

Else

MsgBox(0,"",ControlCommand( "Checker v1.0.3", "", "TButton3", "IsChecked", ""))

EndIf

have it with isenable

Edited by wittenberg
Link to comment
Share on other sites

how i could write it should wait for isenable = 1

for example software is running and isenable is = 0 then i activate my au3 file but it dont work then if the button switch to isenable = 1

CODE

$start = ControlCommand( "Checker v1.0.3", "", "[CLASS:TButton; INSTANCE:3]", "IsEnabled", "")

$red = PixelSearch( 727, 57, 780, 65, 0xff0000 )

$black = PixelSearch( 727, 57, 780, 65, 0xffff00 )

$rred = PixelSearch(897, 106, 897, 106, 0x000000 )

while 1

if $start = true AND $red = True Then

MsgBox(0, "", "rot")

ElseIf $start = true AND $black = true Then

MsgBox(0, "", "schwarz")

EndIf

Wend

Edited by wittenberg
Link to comment
Share on other sites

While 1
    $start = ControlCommand("Checker v1.0.3", "", "[CLASS:TButton; INSTANCE:3]", "IsEnabled", "")
    $red = PixelSearch(727, 57, 780, 65, 0xff0000)
    $black = PixelSearch(727, 57, 780, 65, 0xffff00) ; < 0xffff00 = yellow
    $rred = PixelSearch(897, 106, 897, 106, 0x000000) ; < 0x000000 = black
    
    If $start = True And $red = True Then
        MsgBox(0, "", "rot")
    ElseIf $start = True And $black = True Then
        MsgBox(0, "", "schwarz")
    EndIf
    
WEnd

Link to comment
Share on other sites

While 1
    $start = ControlCommand("Checker v1.0.3", "", "[CLASS:TButton; INSTANCE:3]", "IsEnabled", "")
    $red = PixelSearch(727, 57, 780, 65, 0xff0000)
    $black = PixelSearch(727, 57, 780, 65, 0xffff00) ; < 0xffff00 = yellow
    $rred = PixelSearch(897, 106, 897, 106, 0x000000) ; < 0x000000 = black
    
    If $start = True And $red = True Then
        MsgBox(0, "", "rot")
    ElseIf $start = True And $black = True Then
        MsgBox(0, "", "schwarz")
    EndIf
    
WEnd
thanks dude it works

can i make an if in a if? like in c++

Link to comment
Share on other sites

Yep, not problem to nest statements.

$a = True
$b = True
$c = True
while 1
    $a = not $a
    $b = not $a
    $c = not $b
    if $a Then
        ConsoleWrite("a" & @crlf)
        if $c then
            ConsoleWrite("c" & @crlf)
        endif
    endif
    if $b Then
        ConsoleWrite("b" & @crlf)
        if $c then
            ConsoleWrite("c" & @crlf)
        endif
    endif
wend
Link to comment
Share on other sites

i tried out but dont works it only checks red and dont work if is black

$red = PixelSearch( 727, 57, 780, 65, 0xff0000 )
$black = PixelSearch( 727, 57, 780, 65, 0xffff00 )
$rred = PixelSearch(897, 106, 897, 106, 0x000000 )
    

while 1 
WinMove("Checker v1.0.3", "", 850, 50)
$start = ControlCommand( "Checker v1.0.3", "", "[CLASS:TButton; INSTANCE:3]", "IsEnabled", "")



if $start = true AND  $red = True Then
MouseClick("left",350,400,1)
sleep(1000)
MouseClick("left",190,430,1)
sleep(20000)
    if $start = true AND  $red = True Then
        MouseClick("left",350,400,2)
        sleep(1000)
        MouseClick("left",190,430,1)
        sleep(1000)
    ElseIf $start = true AND  $black = True Then
        MouseClick("left",887,104,1)
        EndIf
Sleep(1000)
MouseClick("left",887,104,1)

ElseIf $start = true AND $black= true Then
MouseClick("left",410,440,1)
Sleep(1000)
MouseClick("left",190,430,1)
sleep(20000)
    If $start = true AND $black = true Then
            MouseClick("left",410,440,2)
            Sleep(1000)
            MouseClick("left",190,430,1)
            sleep(1000)
        ElseIf $start = true AND $red = true
            MouseClick("left",887,104,1)
            EndIf
MouseClick("left",887,104,1)
EndIf


Wend
Edited by wittenberg
Link to comment
Share on other sites

While 1
$black = PixelSearch(727, 57, 780, 65, 0xffff00) ; < 0xffff00 = yellow
$rred = PixelSearch(897, 106, 897, 106, 0x000000) ; < 0x000000 = black
Your color codes are wrong, use COP to determine the right values ^_^

and additionally I guess the PixelSearch() should be within the loop, or else the search will only be performed one time!

Edited by KaFu
Link to comment
Share on other sites

Your color codes are wrong, use COP to determine the right values ^_^

and additionally I guess the PixelSearch() should be within the loop, or else the search will only be performed one time!

no thats ok it should be

and rred dont need

ok i try pixelsearch within the loop

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...