Sign in to follow this  
Followers 0
lolp1

Complile error:

5 posts in this topic

I belive this is based of larrys code, but I have ran into a compile error:

When I run this it runs fine:

Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79

Global $pixel = Int(IniRead(".\PixelSearch.ini","Main","PixelColor","-1"))
Global $chksum = Int(IniRead(".\PixelSearch.ini","Main","PixelCheckSum","-1"))

If $pixel = -1 Or $chksum = -1 Then
    MsgBox(4096,"Error","Could not read INI")
    Exit
EndIf

$VIRTUALDESKTOPWIDTH = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALWIDTH)
$VIRTUALDESKTOPWIDTH = $VIRTUALDESKTOPWIDTH[0]
$VIRTUALDESKTOPHEIGHT = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALHEIGHT)
$VIRTUALDESKTOPHEIGHT = $VIRTUALDESKTOPHEIGHT[0]

HotKeySet("`","find")

While 1
    ToolTip("Press ` (Tilda key) to" & @LF & "find the area in PixelSearch.ini.")
    Sleep(100)
WEnd

Func find()
    $x = 0
    $y = 0
    $ypixel = $VIRTUALDESKTOPHEIGHT - 1
    While 1
        $xy = PixelSearch($x,$y,$VIRTUALDESKTOPWIDTH - 1,$ypixel,$pixel)
        If @error And $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)Then
            MsgBox(4096,"Error","Could not find area.")
            Exit
        ElseIf @error Then
            $y = $ypixel + 1
            $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)
            $x = 0
        ElseIf $chksum = PixelCheckSum($xy[0]-5,$xy[1]-5,$xy[0]+5,$xy[1]+5) Then
            Mousemove($xy[0],$xy[1])
            ToolTip("There it is.")
            Sleep(3000)
            Exit
        Else
            $y = $xy[1]
            $ypixel = $y
            $x = $xy[0] + 1
        EndIf
    WEnd
EndFunc

How ever when I run this:

Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79

Global $pixel = Int(IniRead(".\PixelSearch.ini","Main","PixelColor","-1"))
Global $chksum = Int(IniRead(".\PixelSearch.ini","Main","PixelCheckSum","-1"))

If $pixel = -1 Or $chksum = -1 Then
    MsgBox(4096,"Error","Could not read INI")
    Exit
EndIf

$VIRTUALDESKTOPWIDTH = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALWIDTH)
$VIRTUALDESKTOPWIDTH = $VIRTUALDESKTOPWIDTH[0]
$VIRTUALDESKTOPHEIGHT = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALHEIGHT)
$VIRTUALDESKTOPHEIGHT = $VIRTUALDESKTOPHEIGHT[0]

HotKeySet("`","find")

While 1
    ToolTip("Press ` (Tilda key) to" & @LF & "find the area in PixelSearch.ini.")
    Sleep(100)
WEnd

Func find()
    $x = 0
    $y = 0
    $ypixel = $VIRTUALDESKTOPHEIGHT - 1
    While 1
        $xy = PixelSearch($x,$y,$VIRTUALDESKTOPWIDTH - 1,$ypixel,$pixel)
        If @error And $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)Then
            MsgBox(4096,"Error","Could not find area.")
            Exit
        ElseIf @error Then
            $y = $ypixel + 1
            $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)
            $x = 0
        ElseIf $chksum = PixelCheckSum($xy[0]-5,$xy[1]-5,$xy[0]+5,$xy[1]+5) Then
            Mouseclick($xy[0],$xy[1])
            ToolTip("There it is.")
            Sleep(3000)
            Exit
        Else
            $y = $xy[1]
            $ypixel = $y
            $x = $xy[0] + 1
        EndIf
    WEnd
EndFunc

Note: The thing that changed was

Mousemove($xy[0],$xy[1])

To:

Mouseclick($xy[0],$xy[1])

When I run it I get this error:

Error: Incorrect number of parameters in function call.

Any advice?

Share this post


Link to post
Share on other sites



You forgot "left"


[center]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.[/center]

Share this post


Link to post
Share on other sites

I tryed:

[Mouseclick("left")($xy[0],$xy[1])

I get error:

Error: Illegal text at the ed if the statement[/code[

Any help apperciatedk

Share this post


Link to post
Share on other sites

Try

Mouseclick("left",$xy[0],$xy[1])


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thanks.

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