Jump to content

While .. WEnd question


Baksteen
 Share

Recommended Posts

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

Link to comment
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 2022-02-19 - Version 1.6.1.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 (NEW 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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...