implite Posted May 6, 2012 Share Posted May 6, 2012 (edited) 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 Sleep(100) WEnd Func Gstart() ;<---- this is where my line 13 is. Sleep(300) $Getpixel = PixelSearch(361, 197, 367, 196, 0x4A494A, 10) If Not @error Then Gexit() else If $Getpixel = $Pixelgray Then Send("g") EndIf EndFunc ;==>Gstart Func Gexit() MsgBox(0, "exit box", "Script exited") Exit 0 EndFunc ;==>Gexit can anyone explain to me what im doing wrong? Edited May 6, 2012 by implite Link to comment Share on other sites More sharing options...
somdcomputerguy Posted May 6, 2012 Share Posted May 6, 2012 On line 13, change Else If to ElseIf.Welcome to the Forum! - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
implite Posted May 6, 2012 Author Share Posted May 6, 2012 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 comment Share on other sites More sharing options...
somdcomputerguy Posted May 6, 2012 Share Posted May 6, 2012 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 comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now