Jump to content

Conditional statement based on pixel color


Recommended Posts

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

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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