Sign in to follow this  
Followers 0
computergroove

I have a logic problem I cannot figure out

3 posts in this topic

#1 ·  Posted (edited)

I have 4 vnc windows next to each other. If one of the screens goes black (remote device goes into standby) I want to right click it if the screen is totally black for 10 seconds to wake it up. When I start it with the 4th vnc window blacked out the tooltip displays 0,0,0,0 to 0,0,0,1 and stays there. The vnc screens are 320 pixels wide and are lined up next to each other. Any help?

Global $Number = 4
Global $BlackScreen1 = 0
Global $BlackScreen2 = 0
Global $BlackScreen3 = 0
Global $BlackScreen4 = 0 

While 1
     BlackScreen()
     Sleep(1000)
     ToolTip("BlackScreenCount 10: " & $BlackScreen1 & " " & $BlackScreen2 & " " & $BlackScreen3 & " " & $BlackScreen4, 0, 0)
WEnd

Func BlackScreen()
    Local $BSX1 = 21
    Local $BSX2 = 278
    Local $BSX3 = 28
    Local $BSX4 = 254
    For $i = 1 To $Number
        Local $C1 = PixelGetColor($BSX1,72)
        Local $C2 = PixelGetColor($BSX2,72)
        Local $C3 = PixelGetColor($BSX3,426)
        Local $C4 = PixelGetColor($BSX4,434)
        If $C1 == 0 And $C2 == 0 And $C3 == 0 And $C4 == 0 And $BSX1 == 21 Then
            $BlackScreen1 += 1
        Else
            $BlackScreen1 = 0
        EndIf
        If $C1 == 0 And $C2 == 0 And $C3 == 0 And $C4 == 0 And $BSX1 == 341 Then
            $BlackScreen2 += 1
        Else
            $BlackScreen2 = 0
        EndIf
        If $C1 == 0 And $C2 == 0 And $C3 == 0 And $C4 == 0 And $BSX1 == 661 Then
            $BlackScreen3 += 1
        Else
            $BlackScreen3 = 0
        EndIf
        If $C1 == 0 And $C2 == 0 And $C3 == 0 And $C4 == 0 And $BSX1 == 981 Then
            $BlackScreen4 += 1
        Else
            $BlackScreen4 = 0
        EndIf
        If $BlackScreen1 >= 10 Then
            MouseClick("Right",21,72)
            Sleep(1000)         
            $BlackScreen1 = 0
        EndIf
        If $BlackScreen2 >= 10 Then
            MouseClick("Right",341,72)
            Sleep(1000)         
            $BlackScreen2 = 0
        EndIf
        If $BlackScreen3 >= 10 Then
            MouseClick("Right",661,72)
            Sleep(1000)         
            $BlackScreen3 = 0
        EndIf
        If $BlackScreen4 >= 10 Then
            MouseClick("Right",981,72)
            Sleep(1000)         
            $BlackScreen4 = 0
        EndIf
        $BSX1 += 320;checks the vnc window 320 pixels right of first vnc window X Position ($BSX1)
                $BSX2 += 320
                $BSX3 += 320
                $BSX4 += 320
    Next
EndFunc
Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites



your script should work, maybe the pixels you search are  blackish

any way here is a more compresed version, I tested it with a black picture and it works

Global $Number = 4
Global $timer[$Number]

For $i=0 to $Number-1
    $timer[$i] = 0
Next

While 1
     BlackScreen()
     Sleep(200)
WEnd

Func BlackScreen($x1=21,$x2=28,$x3=254,$x4=258)
    For $i = 0 To $Number -1
        If PixelGetColor($x1+320*$i,72)=0 Then
            If PixelGetColor($x2+320*$i,72)=0 Then
                If PixelGetColor($x3+320*$i,426)=0 Then
                    If PixelGetColor($x4+320*$i,434)=0 Then
                        If $timer[$i]=0 Then $timer[$i]=TimerInit()
                    EndIf
                EndIf
            EndIf
        Else
            $timer[$i] = 0
        EndIf
        If $timer[$i]<>0 and TimerDiff($timer[$i]) >= 10000 Then
            MouseClick("Right",21+320*$i,72)
            $timer[$i] = 0
        EndIf
    Next
EndFunc

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