Jump to content
Sign in to follow this  
Mars

Script not working

Recommended Posts

Mars

I made a script that compares two images, and then if it finds a difference it is supposed to move the mouse over the pixel. The problem is it always moves the mouse on the first pixel, even if the two images are exactly the same. Here is my code:

$X=327
$Y=302
$GUIX=3
$GUIY=23
$Done=0

Sleep(1000)
SplashImageOn("CAPTCHA", "Image.bmp", 220, 160, 0, 0)

Do
    Do
        $ColorCheck=PixelGetColor($GUIX,$GUIY)
        PixelSearch($X,$Y,$X,$Y,$ColorCheck,40)
        If @error Then
            MouseMove($X,$Y,0)
            $Done=1
        EndIf
        $X=$X+1
        $GUIX=$GUIX+1
    Until $GUIX=223 Or $Done=1
    $X=327
    $Y=$Y+1
    $GUIY=$GUIY+1
Until $Y=183 Or $Done=1
SplashOff()

GUIX and GUIY being the image file that is opened, X and Y being the actual image.

Share this post


Link to post
Share on other sites
martin

I made a script that compares two images, and then if it finds a difference it is supposed to move the mouse over the pixel. The problem is it always moves the mouse on the first pixel, even if the two images are exactly the same. Here is my code:

$X=327
$Y=302
$GUIX=3
$GUIY=23
$Done=0

Sleep(1000)
SplashImageOn("CAPTCHA", "Image.bmp", 220, 160, 0, 0)

Do
    Do
        $ColorCheck=PixelGetColor($GUIX,$GUIY)
        PixelSearch($X,$Y,$X,$Y,$ColorCheck,40)
        If @error Then
            MouseMove($X,$Y,0)
            $Done=1
        EndIf
        $X=$X+1
        $GUIX=$GUIX+1
    Until $GUIX=223 Or $Done=1
    $X=327
    $Y=$Y+1
    $GUIY=$GUIY+1
Until $Y=183 Or $Done=1
SplashOff()

GUIX and GUIY being the image file that is opened, X and Y being the actual image.

Shouldn't $GUIX be set back to 23 after the first inner Do loop?

Anyway, there isn't enough information there for me to know what the problem is. Where is the image that is being compared with the one on the splash window? Presumably they both have the same sizes, but how did you decide on the initial x,y coordinates for each image?

Have you tried creating 2 identical images in indentical ways on different parts of a gui and comparing them to see if your comparison method works?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Mars

Shouldn't $GUIX be set back to 23 after the first inner Do loop?

Anyway, there isn't enough information there for me to know what the problem is. Where is the image that is being compared with the one on the splash window? Presumably they both have the same sizes, but how did you decide on the initial x,y coordinates for each image?

Have you tried creating 2 identical images in indentical ways on different parts of a gui and comparing them to see if your comparison method works?

Uh, yeah I fixed that, and the second until was wrong. Thanks, but it still isn't working.

The images are the same size, but there is another image that I am trying to find within it.

Share this post


Link to post
Share on other sites
SmOke_N

Captcha cracking isn't something that is looked at admirably here. People protect their sites/software for a reason.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×