Jump to content
JohnnyDepth

Conditional statement based on pixel color

Recommended Posts

JohnnyDepth

Hello!

I am writing a simple script(should be simple) that logs me into a certain website.

 

I am trying to write a subroutine that waits until the page is finished loading before attempting to type in the log-in information.  I am testing this by determining if the page is a specific color(once the page is the specific color, I know it has finished loading)

 

This function is not working and I was hoping someone could help me out.

Subroutine:

Func PlexLogInLoaded()
    $varLoaded = 0
    $LogInColor = 0

    WinWaitActivate("Plex Manufacturing Cloud - Login - Internet Explorer")
    $LogInColor = PixelGetColor(1293, 697)
    If $LogInColor == 0xFFFFBB Then
        $varLoaded = 1
    EndIf
EndFunc

In the main script I have this:

Call PlexLogInLoaded()
While $varLoaded == 0
    Sleep(500)
    Call PlexLogInLoaded()
WEnd

 

Edited by JohnnyDepth

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Which browser do you use? AutoIt comes with an UDF for IE plus you will find UDFs for FF and Chrome in the Example Scripts section. Much more reliable than to wait for a color to appear.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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

×