Alexxander Posted July 7, 2013 Share Posted July 7, 2013 (edited) Hi all i an new to Autoit i want to make a script that search for a pic and click it and repeate that for 10 times i had readed the help doc and some postes in the forums but no luck the search and click itself is working but i cant get the loop to work any ideas ? #include <ImageSearch.au3> $x = 0 $y = 0 $NUM = 0 While $NUM <= 10 Func start() Do $Search = _ImageSearch('pic.bmp', 0, $x, $y, 0) if $Search = 0 Then sleep (1000) Until $Search = 1 If $Search = 1 Then MouseMove($x, $y,10) MouseClick("left", $x, $y, 1) EndIf EndFunc WEnd when i run this code it give the following error C:UsersAdministratorDownloadsImageSearchImageSearchtut.au3 (10) : ==> "While" statement has no matching "Wend" statement.: Func start() Edited July 7, 2013 by alexander95 Link to comment Share on other sites More sharing options...
water Posted July 7, 2013 Share Posted July 7, 2013 Which program do you try to automate? Often there are faster and more reliable ways to do what you want to do. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted July 7, 2013 Share Posted July 7, 2013 Because have a function inside a while wend loop. It is not allowed. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Alexxander Posted July 7, 2013 Author Share Posted July 7, 2013 Which program do you try to automate? Often there are faster and more reliable ways to do what you want to do. Because have a function inside a while wend loop. It is not allowed. Please guys just tell me how to fix it i want to use this method thank u Link to comment Share on other sites More sharing options...
water Posted July 7, 2013 Share Posted July 7, 2013 Alexander95, this is no "I have a problem please solve it for me" forum. We ask questions for a reason. So please give us some answers and we will see how we can help you. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 7, 2013 Moderators Share Posted July 7, 2013 alexander95,JohnOne has told you what is wrong with your script; water asked for more information so he could perhaps offer some more focused help. And you complain? M23 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...
Alexxander Posted July 7, 2013 Author Share Posted July 7, 2013 (edited) this is no "I have a problem please solve it for me" forum. We ask questions for a reason. So please give us some answers and we will see how we can help you. bro i want to learn this method there is no program i want to run on it i just wanna learn it now i am seeing the autoit help doc i used all the loop methods but they are giving errors For...Next While...WEnd Do...Until For...In...Next any ideas ? Edited July 7, 2013 by alexander95 Link to comment Share on other sites More sharing options...
bleh Posted July 7, 2013 Share Posted July 7, 2013 You have 2 "ifs" and only one Endif. Either you put another EndIf in or you use ElseIf. (I think) And your func starts in the middle of a loop. Link to comment Share on other sites More sharing options...
Alexxander Posted July 7, 2013 Author Share Posted July 7, 2013 alexander95, JohnOne has told you what is wrong with your script; water asked for more information so he could perhaps offer some more focused help. And you complain? M23 i am not complaining he is doing a favor for me and i am so thankful but the thing is that i want to learn this type of automation thank u guys Link to comment Share on other sites More sharing options...
water Posted July 7, 2013 Share Posted July 7, 2013 To learn AutoIt please have a look at the wiki. There is a tutorial section which is a good place to start. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Alexxander Posted July 7, 2013 Author Share Posted July 7, 2013 You have 2 "ifs" and only one Endif. Either you put another EndIf in or you use ElseIf. (I think) And your func starts in the middle of a loop. i made them to i still have the following error C:UsersAdministratorDownloadsImageSearchImageSearchtut.au3 (12) : ==> "Do" statement has no matching "Until" statement.: Func start() thank u for attempting to help me guys it is so apriciated Link to comment Share on other sites More sharing options...
bleh Posted July 7, 2013 Share Posted July 7, 2013 (edited) If you use "Do", you will have to have "Until" somewhere. Somewhere where AutoIT can find it, not hidden in another func or something. Do <- This does the following command over and over again Until <- Until a certain criteria is matched. For example: Do $variable = $variable + 1 Until $variable = 4 This would add 1 to the variable "Until" the variable equals 4. I hope you understand what i mean. Edited July 7, 2013 by bleh Link to comment Share on other sites More sharing options...
JohnOne Posted July 7, 2013 Share Posted July 7, 2013 Move the function outside of the loop, and call the function from inside the loop. Add a Sleep() in the loop too. Alexxander 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheSaint Posted July 7, 2013 Share Posted July 7, 2013 (edited) Hopefully this is clear as mud. But I'll let you fill in the missing dots, etc. While x < y ..... Start() ...... Wend Func Start() ........ Do ..... ..... Until x ........ EndFunc You really need to try some tutorials and carefully read the Help file though. And probably put in the sleep that JohnOne mentioned. Edited July 7, 2013 by TheSaint Alexxander and ashraful089 2 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Solution PKG Posted July 8, 2013 Solution Share Posted July 8, 2013 Use this code. #include <ImageSearch.au3> $x = 0 $y = 0 $NUM = 0 While $NUM <= 10 start() Sleep(10) WEnd Func start() Do $Search = _ImageSearch('pic.bmp', 0, $x, $y, 0) If $Search = 0 Then Sleep(1000) Until $Search = 1 If $Search = 1 Then MouseMove($x, $y, 10) MouseClick("left", $x, $y, 1) EndIf EndFunc ;==>start Alexxander 1 Link to comment Share on other sites More sharing options...
James Posted July 8, 2013 Share Posted July 8, 2013 bro i want to learn this method Bro, you can't use a method which doesn't work. Read what people are saying, if your native language isn't English, use Google Translate. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
spudw2k Posted July 8, 2013 Share Posted July 8, 2013 You'll have to increment $NUM else it will never reach 10 and you will loop forever. Also, just FYI, starting at 0 and looping until <= 10 is actually 11 rounds...assuming were talking integers here. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Blue_Drache Posted July 8, 2013 Share Posted July 8, 2013 Does this have anything to do with your adfly bot? '?do=embed' frameborder='0' data-embedContent>> Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Alexxander Posted July 8, 2013 Author Share Posted July 8, 2013 thank you guys for help really appreciated ... 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