Baksteen 0 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 Share this post Link to post Share on other sites
water 2,387 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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
Baksteen 0 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 Share this post Link to post Share on other sites
Baksteen 0 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. Share this post Link to post Share on other sites
VelvetElvis 2 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 Share this post Link to post Share on other sites
Baksteen 0 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! Share this post Link to post Share on other sites