Jump to content

Displaying a timer and waiting for a pixelgetcolor change help


Go to solution Solved by computergroove,

Recommended Posts

I am trying to get a tooltip to show up in the upper left corner of the screen and display the current timerdiff and also what value of pixelgetcolor as my screen changes. I am not sure if my script is reading the pixel color like the app I got the coords from.

Func AT1()
    MouseClick("Left",51,84,1)
    While 1
        Local $ATNV1 = PixelGetColor(38,351)
        Local $hTimer = TimerInit()
        Local $fDiff = TimerDiff($hTimer)
            If  $ATNV1 == 4821504 or $fDiff <= 20000 Then
                MouseMove(38,351)
                ToolTip("")
                ExitLoop
            Else
                Local $ATNV1 = PixelGetColor(38,351)
                Local $fDiff = TimerDiff($hTimer)
                ToolTip($ATNV1 & " 4821504" & @CRLF & "20 sec " & $fDiff,0,0)
                Sleep(100)
            EndIf
    WEnd
    MouseClick("Left",38,351)
EndFunc

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

Link to comment
Share on other sites

  • Solution

The reason I wanted the tooltip for the timer diff was because i wanted to make sure my code was working. I was confused about what timerdiff and timerinit did. Timerinit takes a realtime clock reading and saves it. TimerDiff is the difference between the time timerdiff and the number stored as the time stamp from TimerInit. 20000 is 20 seconds. The following works perfectly:

Func AT1()
    MouseClick("Left",51,84,1)
    Local $iTimer = TimerInit()
    While 1
        Local $ATNV1 = PixelGetColor(38,351)
        $Seconds = TimerDiff($iTimer)
            If  $ATNV1 == 4821505 or $Seconds >= 20000 ThenThen
                MouseMove(38,351)
                Sleep(500)
                MouseClick("Left",38,351,1)
                ExitLoop
            Else
                Sleep(100)
            EndIf
    WEnd
    MouseClick("Left",38,351)
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

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...