Jump to content

Recommended Posts

Posted

Hi!

I'm not completely new to coding but I am new to AutoIt. I still have much to learn about programming.

I was just wondering about something useless and so I thought I'd make a post to see your thoughts. Could you make a function that would declare and initialize a variable? It would work by passing the name of the variable and the initial value as arguments.

I'm sure that there is no point in this function.

Thanks!

Matt

Posted

IMO it is very stupid to use a function to create your variables. Debugging will become 100 times harder. You will run into many problems. Just use the tried and proven methods. Global and Local are the best.

Cheers,

Brett

Posted

IMO it is very stupid to use a function to create your variables. Debugging will become 100 times harder. You will run into many problems. Just use the tried and proven methods. Global and Local are the best.

Cheers,

Brett

Cool. Agreed. I didn't want to do it myself, just wondering if it were possible.

Thanks to all posters! =D

Posted

As said before, scope will be an issue, use Global or Local instead of Dim. Dim sets it to Local by default so it won't be seen out side of the function like other programming languages. See the helpfile for more info.

I have a file that has all of my Global vars declared then I include it into my scripts - #include "global.au3" Makes things simple.

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]

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
  • Recently Browsing   0 members

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