Jump to content

Recommended Posts

Posted

1st time appender!

I've used Autoit numerous times and it's a good language. I have a situation where I want to dynamically create a variable with a name equal to the value of some other fixed name variable. For example if $var1 = "bob", then I want to create a variable named "bob". Since the fixed variable can have any value, the newly created variable name is dynamic. I've done this in a few other langauges especially when I'm processing large ini files. I read a key/value set from an INI and then create a variable with the key "name" equal to the key "value".

Can anything like this be done in Autoit??

Thanks

BobH

Posted

Have you looked at IniReadSection? It will store the results in an array which you can refer to without having to create variables for every key

Posted

On the surface, it looks like "Assign" will do what I'm looking for. I scanned the help numerous time and missed it. Thanks.

I'm not using inireadsection because it would create the array elements in the order they exist in the ini file. In my case I cannot assume the keys are always in the same order. Creating variables from the keys means I can just check the value of the variable regardless of the its order in the section.

Thanks again for the quick responses

BobH

Posted

You could also create an array in this case first column key name second column key value.

and search the array every time you want a value, you could make a function for it.

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...