Jump to content
Sign in to follow this  
Like2Code

ew to AutoIT

Recommended Posts

Like2Code

Hi All, I'm a recent convert from VBScript, I have actually want to start using AutoIt before but did not have the time to devote. I really like it but I have a few questions.

Is there an equivalent to 'Option Explicit'?

Is 'Dim' the same as 'Global' if done outside of a function or sub?

What is the purpose of 'Local'?

Is there a general 'Err' object to handle errors?

Thanks!!

Edit: sorry the title was suppose to say "New to AutoIt"

Edited by Like2Code

Share this post


Link to post
Share on other sites
Pain

Opt("MustDeclareVars", 1)

From the helpfile:

The difference between Dim, Local and Global is the scope in which they are created:

Dim = Local scope if the variable name doesn't already exist globally (in which case it reuses the global variable!)

Global = Forces creation of the variable in the Global scope

Local = Forces creation of the variable in the Local/Function scope

No, you have to handle the errors yourself.

Share this post


Link to post
Share on other sites
PsaltyDS

Dim = Local scope if the variable name doesn't already exist globally (in which case it reuses the global variable!)

Note that DIM is considered bad practice. Much better to be aware of the scope you need and use only Global or Local as required.

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×