IIIRAZORIII Posted March 12, 2013 Share Posted March 12, 2013 (edited) Trying to make a simple do until function using image search. problem is i have no idea what i'm doing wrong. I'm very new to coding (<1week) so any help with working example of the following with details explaining how xyz is done to help me learn would be great help. #include <ImageSearch.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("^{PAUSE}", "Terminate") ;The part Below i need help with. $Search = _WaitForImageSearch("C:\Users\IIIRAZORIII\Desktop\image.bmp") Do MouseMove(300,300,0) sleep(300) until $Search = 1 Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is Paused',1047,0," Warning",0,4) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc I'm sorry i understand this gets asked alot, but the examples i've seen i don't understand. and the syntax within the attached file, i'm not sure what, if any changes i have to make. thank you in advanceImageSearch.au3 Edited March 12, 2013 by IIIRAZORIII Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 12, 2013 Moderators Share Posted March 12, 2013 What application are you trying to manipulate? There may be a much easier way to accomplish this rather than using imagesearch. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
IIIRAZORIII Posted March 12, 2013 Author Share Posted March 12, 2013 at this stage i have no program yet, just trying to learn common features i have seen within vtask studio. got frustrated with no toggle pause with that program, so trying to learn autoit : ) anyways i'm going try and compile a shopping list of mutli items into list format within excel, data entry will be very large and nothing is set position. image searching will work nice, (if i can get it working) atm thought just learning how xyz works and why is the stage i'm currently at and the example and details i been readin don't really help explain much to someone who is complety new to coding. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 12, 2013 Moderators Share Posted March 12, 2013 (edited) Well, understand that we follow a "teach a man to fish" method here, rather than spoon-feeding code (best way to learn). Rather than generalized "I wanna learn everything in AutoIt" questions, the best format for gaining assistance on this forum is always going to be something like this: I am trying to do a, b, and c in program xyz on this Operating System using this version of AutoIt (detailed explanation) I have attempted to solve my problem by doing this (post code) I expected the script to do this, but instead, it is doing this (give error codes) Edited March 12, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
IIIRAZORIII Posted March 12, 2013 Author Share Posted March 12, 2013 (edited) i am trying to get wait for image search to work, in SciTE-Lite Version 2.28 On Windows 7 x64 so far i have on been able to get the following to work. #include <ImageSearch.au3> HotKeySet("s", "Start") $x = 0 $y = 0 func Start() $Search = _ImageSearch("C:\Users\IIIRAZORIII\Desktop\image.bmp", 0, $x , $y, 0) If $Search = 1 Then MouseMove($x, $y,0) EndIf EndFunc While 1 Sleep(100) WEnd within the same UDF attatched within the first post there is a" WaitForImageSearch" function that i'm unable to get working as i don't understand the syntax or instructions given. i was hoping someone would be able to post a working script using the the "WaitForImageSearch" function so i can learn the syntax with a working example. allowing me to make edits for trial and error to see what works and what doesn't. In order to be able to do this i need a working prototype. and hence the reason i'm asking for help. i expect the script below to wait for x image if the image is true the mouse moves telling me its working (could use message box as i've seen most do) if false the script will repeat untill x image is found #include <ImageSearch.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("^{PAUSE}", "Terminate") ;The part Below i need help with. $Search = _WaitForImageSearch("C:\Users\IIIRAZORIII\Desktop\image.bmp") Do MouseMove(300,300,0) sleep(300) until $Search = 1 Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is Paused',1047,0," Warning",0,4) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc anyways hope this is the correct way for asking for help now. thank you Edited March 12, 2013 by IIIRAZORIII Link to comment Share on other sites More sharing options...
IIIRAZORIII Posted March 12, 2013 Author Share Posted March 12, 2013 i'm just curious, why the lack of help for newcomers, every thread i read they are blasted for asking for help with simple things. i understand there is a helpfile, but it doesn't include everything and i'm sure all the pro's had similar questions when they started out. anyways if there is something i'm doing wrong, please let me know. just seems like myself and other people new to coding are being stone walled with every question. Link to comment Share on other sites More sharing options...
LarryDalooza Posted March 12, 2013 Share Posted March 12, 2013 Just your impatience... You are like having a yappy Chihuahua at the foot of the forum. _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance,$HBMP=0) try this... (60 second search) Global $iX, $iY $search = _WaitForImageSearch("C:\Users\IIIRAZORIII\Desktop\image.bmp", 60, 1, $iX, $iY, 0) If $search = 1 Then MouseMove($iX, $iY) AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
IIIRAZORIII Posted March 12, 2013 Author Share Posted March 12, 2013 (edited) Sorry you may be right, just feel like jumping through hoops sometimes. been trying to work this out for last 3 days via google threads youtube vids etc etc,this thread was the last port of call. anyways, i got this error : ==> Subscript used with non-Array variable.: if $result[0]="0" then return 0 if $result^ ERROR also got the same when changing $search to $result there is more than one image on my desktop visable as its the autoit icon i'm using for testing. i also increased the tolerance to 16 with no avail. tryed this also same error though $search = _WaitForImageSearch("C:\Users\IIIRAZORIII\Desktop\image.bmp", 60, 1, $iX, $iY, 30) If IsArray($search) = 1 Then MouseMove($iX, $iY) Edited March 12, 2013 by IIIRAZORIII Link to comment Share on other sites More sharing options...
Xandy Posted March 13, 2013 Share Posted March 13, 2013 (edited) The array and subscript means that the variable wasn't an array at the time of the check. This usually happens when a function that returns an array doesn't return an array in a given instance. Use isarray($arrayName) to test if the variable is an array before testing the indexs. example: (in this example $arrayName[0] will not be evaluated if $arrayName is not an array) if isarray($arrayName) then $arrayName[0]+= 1 endif I didn't learn to program over night, this forum didn't even exist yet. or the internet as it is today for that matter. Take your time, keep moving, backup your work. This forum can help you, but not if you piss people off. Best of luck, X and Y Edited March 13, 2013 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2013 Moderators Share Posted March 13, 2013 IIIRAZORIII,i'm just curious, why the lack of help for newcomers, every thread i read they are blasted for asking for help with simple things. i understand there is a helpfile, but it doesn't include everything and i'm sure all the pro's had similar questions when they started out.Someone asks this question about once a month - and I always give the same answer:I do not believe there is a lack of help for newcomers - in fact several of us make a special effort to respond to new members - but there is a lack of willingness among the more experienced coders here to help those who appear to make no effort to help themselves. This attitude usually manifests itself in asking for example code without the OP having made any effort to produce something - or by asking questions which could be very simply answered by a little study of the Help file. As has been pointed out previously, our philosophy is "teach to fish" rather than merely acting as fishmongers. In this case you are asking for help on a specific function within a UDF from the Examples section. How many people here do you think use that particular UDF? I certainly never have. In fact, why did you not post this question in the UDF thread itself? That way the author would certainly see it - and who better to help you? So I am not at all surprised that you got little assistance at the start - but please note that you are now being helped. Do not take any of this personally - we are very willing to offer help on specific problems that you encounter, but are not really into giving tutorials on the basics. There are several tutorials in the Wiki to do that. M23 JLogan3o13 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 13, 2013 Moderators Share Posted March 13, 2013 Well said as always Melba (much better than the "yappy chihuahua" reference) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
LarryDalooza Posted March 13, 2013 Share Posted March 13, 2013 Well said as always Melba (much better than the "yappy chihuahua" reference) You on the other hand are a Snarky Mole Rat Xandy 1 AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 13, 2013 Moderators Share Posted March 13, 2013 LOL Way to break out the 4th grade tactics "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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