Sign in to follow this  
Followers 0
Kinesis

IF... THEN... PIXELGETCOLOR... SLOOOOW!

7 posts in this topic

#1 ·  Posted (edited)

I have a do-until loop with 7 if-then statements that look for a certain color at a certain pixel coordinate, and press a button when true. My problem is that the loop is really slow, taking a few seconds to process each if-then statement. Just one pass through the loop could take 10 seconds or more... I dont understand why it is so slow... Shouldnt AutoIt fly through this loop many times per second? Any tips on how I can speed it up would be greatly appreciated. Here is my code:

func test()

If PixelGetColor(1215,736) <> 0xFF9898 Then

;do something

EndIf

If PixelGetColor(84,135) <> 0xFFFFFF Then

;do something

EndIf

If PixelGetColor(163,55) <> 0xC20307 AND PixelGetColor(190,56) <> 0xC20307 AND PixelGetColor(216,56) <> 0xC20307 Then

;do something

EndIf

If PixelGetColor(1165,738) = 0x06BF06 Then

;do something

EndIf

If PixelGetColor(158,59) <> 0xF81C21 Then

;do something

EndIf

If PixelGetColor(160,57) <> 0xF80000 AND PixelGetColor(187,58) <> 0xF80000 AND PixelGetColor(213,58) <> 0xF80000 Then

;do something

EndIf

If PixelGetColor(24,143) <> 0xFFFFFF or PixelGetColor(24,129) <> 0xFFFFFF Then

;do something

EndIf

until PixelGetColor(1230,685) <> 0xB6595C AND PixelGetColor(1248,685) <> 0xB6595C

endfunc

Edited by Kinesis

Share this post


Link to post
Share on other sites



I just tried on my box and its flying like u whould expect, 1000's of Cycles within seconds

Global $count = 0

Test()




func test()

    Do
        If PixelGetColor(1215,736) <> 0xFF9898 Then
        ;do something
        EndIf

        If PixelGetColor(84,135) <> 0xFFFFFF Then
        ;do something
        EndIf

        If PixelGetColor(163,55) <> 0xC20307 AND PixelGetColor(190,56) <> 0xC20307 AND PixelGetColor(216,56) <> 0xC20307 Then
        ;do something
        EndIf

        If PixelGetColor(1165,738) = 0x06BF06 Then
        ;do something
        EndIf

        If PixelGetColor(158,59) <> 0xF81C21 Then
        ;do something
        EndIf

        If PixelGetColor(160,57) <> 0xF80000 AND PixelGetColor(187,58) <> 0xF80000 AND PixelGetColor(213,58) <> 0xF80000 Then
        ;do something
        EndIf

        If PixelGetColor(24,143) <> 0xFFFFFF or PixelGetColor(24,129) <> 0xFFFFFF Then
        ;do something
        EndIf

        $count = $count+1
        Tooltip($count)
        
    until False ;had to Rem the below line because it was true everytime for me
    ;until PixelGetColor(1230,685) <> 0xB6595C AND PixelGetColor(1248,685) <> 0xB6595C

endfunc

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

I did a search on slow scripts and I found a thread talking about how pixelgetcolor is a memory hog, and very slow on vista... I am running windows vista. Is there anything I can do to speed it up?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

yes, Change your Apearance Settings from "Windows Areo" to "windows Vista Basic", I tried it on Windows Server2008 and the script increased in speed 100 fold

Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I adjusted the vista graphical settings for "best performance" and now my sript is doing thousands of cycles per second... Hmm does anyone know why?

Thanks for your input ofLight.

Edited by Kinesis

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@ofLight

Nice sign. Where you find?

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

on desktop Right click/Personalize/Windows color and appearance


There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

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