Baksteen Posted September 9, 2011 Posted September 9, 2011 Hello everyone, First of all, I'm a new scripter trying to learn AutoIt, so please bear with me a little... For my department we had a guy who had build some scripts to automate some of our tasks. He left, and since I am quite enjoying myself learning to script I'm taking this over. In alot of his scripts I see he starts with the includes, then a list of variables, often a GUI created with Koda (something I haven't experimented with yet), then a While ... WEnd loop in which he calls his main function (he usually uses While 1 aka while true...) and then in his main function he calls other functions, those included as UDFs when you install AutoIt and those that he defines himself. Currently, my way of doing things is just defining and calling a main function in which I call other functions. So, basically my scripts look like: First the includes, then the variables, then I call a Function which I define below that with the Func <name>() Endfunc stuff. Then in that function I call other functions which I also define below, or that are included with the AutoIt package as UDF's. Now what I'm wondering about is, why does he use the While.. WEnd loop, what advantage does it have to use this over my way of doing stuff? I was thinking about this and guessed it could be because the While WEnd loop may become a necessity when using Koda to create a GUI. But I'm not sure about this and I haven't got experience with Koda just yet (remember, I'm new!). I'm sorry if I sound stupid, but I hope you can answer my question. Thanks in Advance! Kind regards, Jeroen
water Posted September 9, 2011 Posted September 9, 2011 Without seeing any sample code I guess it's because of the GUI stuff. You display a GUI and then wait for input fo the user (press a button, input data, exit the GUI). In the While loop the user input is handled. Without the While loop the GUI would be displayed for a short moment and then the script would be closed. 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
Baksteen Posted September 9, 2011 Author Posted September 9, 2011 (edited) Yes, thats what I was guessing too, seeing his code. Now this sample is probably broken but here is it anyway: Edited October 7, 2011 by Baksteen
Baksteen Posted September 9, 2011 Author Posted September 9, 2011 Ok I'm sorry I think I shouldve upload an attachment instead. Something else though, Is there any step by step tutorials on creating Koda GUI's for AutoIt? Couldn't really find it on the forum.
VelvetElvis Posted September 9, 2011 Posted September 9, 2011 I think some GUI coding examples would be beneficial (they were to me). Check out this excellent tutorial: There's also the excellent AutoIt Wiki:http://www.autoitscript.com/wiki/Main_Page
Baksteen Posted September 13, 2011 Author Posted September 13, 2011 I think some GUI coding examples would be beneficial (they were to me). Check out this excellent tutorial: There's also the excellent AutoIt Wiki:http://www.autoitscript.com/wiki/Main_Page Velvet, thanks alot for your reply, much appreciated!
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