Jump to content
Sign in to follow this  

Questions I have about autoit

Recommended Posts


I have been using autoit on and off for several years. I occasionally run across posts that say that Autoit isn't as good for programming as other available programs. I don't know why but I really like Autoit and have never really put any effort in learning another programming language. The forum support is incredible. I will sometimes design and sell scripts/programs created in autoit. Is there a benefit to using some other programming language?

Second thing, is there a area where I can better wrap my mind around Local Global and Dim declarations? I don't know when I should declare variables as glaobal, local or even at all.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post

Link to post
Share on other sites

There is a lots of discussion around about this. This tread should really be in chat, FYI.

I have always said autoit is a tool like MS Word. It is great as long as it is used correctly. I you have to write an embedded system AutoIt is a crap language to use. For most windows based automation (boting, testing or dos scripts) it is hard to go past. You have to understand the problem first then pick the best tool.

The help file explains it well, its a scope issue. Good rule of thumb is, don't use Dim, use Global for vars outside of a function and local for vars inside a function. Also don't name a global var and a local var the same in the same script. Doing that and you won't have issues.

Hope that helps.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post

Link to post
Share on other sites

You see, i think what bo8ster said it's valid, you have to gain a background knowledge of what you will have to do, then you can tell which is the best.

But we can also state an objective point. Autoit is a scripting language. It has lot of function written by someone else for you, so you have to use what other people did, having a little space for deep customization.

It's like you have to tidy up your house and you have to choose between someone who does it for you or you doing it. In the first case you will not die, but you might not like how they set up your room. In the second case you did it and you know how you wants things to be placed and done.

Same is for programs in my point of view. In other languages like C,C++ and so on you have more tools, and you have to write most functions by yourself (unless you google for libraries, like the UDF in autoit), so you have you set of thing, more things to do, harder concepts to understand, but more powerful results.

In the other languages there's no _IEFormElementGetCollection, no _ExcelBookOpen, no DirMove and so on. You gotta do them by urself.

Moreover, AS FAR AS I KNOW, autoit is one of the "slowest" in execution (for how much a computer can be slow today :x).

For what concerns variable declarations, this is what i know:

Dim--> Used mainly for arrays, don't know anything else.

Local-->Used into functions, it's created when declasred and destroyed at the end the function, so you can't call it anywhere else.

Global-->It stays into memory for the whole script execution, so you can call it both in and out of functions, whenever u need it.

Bye Bye

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post

Link to post
Share on other sites

The only time that I use Dim() is when I explicitly plan on using the ReDim() function. The only issue I can see with naming Global variables the same as Local variables is when using the ByRef or Const parameters. I have never otherwise run into a problem with declaring Local variables the same (as Global variables) inside a Function. Imagine including 10 or so UDFs if every variable name (Global & Local) had to be unique. I do feel that each variable should be explicitly declared, either locally or globally, no matter how many times it will be referenced. Any script worth creating needs to have Opt('MustDeclareVars', 1)

Edited by Varian

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.