Sign in to follow this  
Followers 0
Baksteen

While .. WEnd question

6 posts in this topic

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



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, thats what I was guessing too, seeing his code.

Now this sample is probably broken but here is it anyway:

Edited by Baksteen

Share this post


Link to post
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0