Jump to content

Why dont this small 13 line script work ???


Recommended Posts

Here is the deal.

This small script finds the windows calculator process.

Then finds the handle of the F-E button on the Scientific Calculator.

Then it is supposed to find a "Pink" pixel on the button.

It does not find a pixel at all on the button.?. Can anyone explain whats wrong?

AutoItSetOption("PixelCoordMode", 2)
If ProcessExists("calc.exe") Then
    MsgBox(0, "process Found", "continue")
EndIf
$handle = ControlGetHandle("Calculator", "", "[CLASS:Button; INSTANCE:22]")
If Not @error Then
    MsgBox(0, "found", "found button F-E")
EndIf
$coord = PixelSearch(0, 0, 31, 24, 0xFF6DF4, 0, 0, $handle)
If Not @error Then
    MsgBox(0, "X and Y of Button F-E:", $coord[0] & "," & $coord[1])
EndIf
Exit (0)

Now if i do it like this it returns a 1 on both message boxes indicating the pixel was found? Other wise "True" WTH?

AutoItSetOption("PixelCoordMode", 2)
$cal = "Calculator"
$button = "[CLASS:Button; INSTANCE:22]"
If ProcessExists("calc.exe") Then
    MsgBox(0, "process Found", "continue")
EndIf
$handle = ControlGetHandle($cal, "", $button)
If Not @error Then
    MsgBox(0, "found", "found button F-E")
EndIf
$coord = PixelSearch(0, 0, 31, 24, 0xFF6DF4, 0, 0, $button)
MsgBox(0, "Test:", $coord)
If Not @error Then
    MsgBox(0, "Test", $coord)
EndIf
Exit (0)
Edited by £åߥ®Ñth
Link to comment
Share on other sites

From the Help file under PixelSearch()

Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y).

$coord = PixelSearch(0, 0, 31, 24, 0xFF6DF4, 0, 0, $button)
;MsgBox(0, "Test:", $coord) ;as soon as you click OK the error level ia reset causing the next line to fail
If Not @error Then
    MsgBox(0, "Test", "X = " & $coord[0] & @CRLF & "Y = " & $coord[1])
EndIf
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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