User751139 Posted June 5, 2015 Share Posted June 5, 2015 (edited) Hello autoit form, I'm looking to make a basic image search script that'll keep looping until i stop it myself. I keep getting error at line 36 which doesn't make any sense to me. Keeps telling me Variable used without being declared...But I've declared it.Any help would be appreciate it expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.10.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ImageSearch.au3> HotKeySet("{END}", "End") HotKeySet("{F1}", "Prison") While 1 Sleep(1) WEnd $x = 0 $y = 0 $x1 = 0 $y1 = 0 $x2 = 0 $y2 = 0 Func Prison() $prison = _ImageSearch("Search.bmp",0,$x,$y,0) $prison1 = _ImageSearch("Recycle.bmp",0,$x1,$y1,0) $prison2 = _ImageSearch("Play.bmp",0,$x2,$y2,0) If $prison = 1 Then MouseClick("left", $x, $y,1,10) sleep(2000) ElseIf $prison1 = 1 Then MouseClick("left", $x1, $y1,1,10) sleep(2000) ElseIf $prison2 = 1 Then MouseClick("left", $x2, $y2,1,10) sleep(2000) EndIf EndFunc While 1 sleep(100) Wend Func End() Exit EndFunc Edited June 5, 2015 by User751139 Link to comment Share on other sites More sharing options...
Developers Jos Posted June 5, 2015 Developers Share Posted June 5, 2015 Can you show the actual error you get?Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
User751139 Posted June 5, 2015 Author Share Posted June 5, 2015 This is weired, what happened to this forum?? my username doesn't show up and my entire post doesn't get posted. Anyways the error says Variable used without being declared at line 34. But i've declared it.. Link to comment Share on other sites More sharing options...
User751139 Posted June 5, 2015 Author Share Posted June 5, 2015 without being declared at line 34.. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 5, 2015 Developers Share Posted June 5, 2015 You just repeated what you said in the original post, so you either think I didn't read it or .... (Lets not go there..) Assume you are running your script from SciTE so show me the the output from the SciTE output pane so I can see what is happening.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
User751139 Posted June 5, 2015 Author Share Posted June 5, 2015 (edited) Looks like it's a google chrome problem anyways, I'm not sire what you are asking Jos. I put it in the simplest term as possible. My code is above when I try to execute the script by clicking the hoykey "F1" in this case I get the error ms gpop up as below: Im not using SciTe Edited June 5, 2015 by User751139 Link to comment Share on other sites More sharing options...
Developers Jos Posted June 5, 2015 Developers Share Posted June 5, 2015 Ok,Reason is simple as the code portion you declare the variables is never reached. Move it above your While-Wend loop.Also ensure you read our forum rules as this all looks again very Game automation related!Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
User751139 Posted June 5, 2015 Author Share Posted June 5, 2015 (edited) actually this is for SCCM advertisement when i'm deplying an image i'm trying to automate the task so i don't have to click a million times. Thanks I've followed your advise, but it seems to only look for the first image, and then it just stops. Doesn't bother going over to the next 3 images Edited June 5, 2015 by User751139 Link to comment Share on other sites More sharing options...
Developers Jos Posted June 5, 2015 Developers Share Posted June 5, 2015 Come on... I hope you are not automating SCCM deployments with an ImageSearch logic.Also your Func name would indicated otherwise... but it's good you are on your way and can now start the debugging process.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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