Jump to content

error on start of my function

Recommended Posts

Im still new at this and trying to understand some things so all help is welcome!

Thanks in advance!!!

When I start the exe of this script I get this message.

Line 13 (File ""):

Error: Illegal text at the end of statement (one statement per line).

Dim $Pixelgray = "Ox4A494A"
Dim $Getpixel

HotKeySet("{HOME}", "GStart")
HotKeySet("{ESC}", "Gexit")

While 1

Func Gstart()  ;<---- this is where my line 13 is.
   $Getpixel = PixelSearch(361, 197, 367, 196, 0x4A494A, 10)
        If Not @error Then
        else If $Getpixel = $Pixelgray Then
EndFunc   ;==>Gstart

Func Gexit()
    MsgBox(0, "exit box", "Script exited")
    Exit 0
EndFunc   ;==>Gexit

can anyone explain to me what im doing wrong?

Edited by implite
Link to post
Share on other sites

On line 13, change Else If to ElseIf.

Welcome to the Forum!

Thanks, that fixed the error but it is still not finding the color im looking for so it will send the g key.

maybe im going about this all wrong?

Link to post
Share on other sites

Look at your whole If statement. @error has a value of 1 if PixelSearch doesn't find what it's looking for where it's looking. If Not @error translates to If @error <> (doesn't equal) 1, so, it'll call the gexit function if it finds the color.

Read thru the Help file some more. There's all kinds of example codes in there, and tutorials can be found in the wiki, and even YouTube.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...