Jump to content

How to use Opt("ExpandVarStrings",1) to expand array variables in strings?


Recommended Posts

Help of "ExpandVarStrings" says nothing about arrays not working, can't find anything on the forum either.

I tried the following:

#include <Array.au3>
Opt("ExpandVarStrings",1)
$a = _ArrayCreate("text1","text2","text3")
$b = "hello"
MsgBox(0,"test","Testing $b$ and $a$[1] and $a[1]$ and $a$[1]$ gives me no correct substitution for all the $a array variables!")

Can anyone tell me how to do this? Thanks in advance.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

It just doesn't do array variables...

:shocked:

Ok, that's a turnoff... It would really have saved me some time. Now I will have to rewrite a LOT of string code manually :(

Thanks anyway.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Ok, that's a turnoff... It would really have saved me some time. Now I will have to rewrite a LOT of string code manually :(

It's not so bad. You did it in six lines, I did it in 6 lines...

Opt("ExpandVarStrings", 1)
Dim $a[3] = ["text1", "text2", "text3"], $b = "hello"
For $n = 0 To UBound($a) - 1
    Assign("var" & $n, $a[$n])
Next
MsgBox(0, "test", "Testing $b$ and $var0$ and $var1$ and $var2$ gives me the correct substitution!")

:shocked:

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
Link to comment
Share on other sites

It's not so bad. You did it in six lines, I did it in 6 lines...

Opt("ExpandVarStrings", 1)
Dim $a[3] = ["text1", "text2", "text3"], $b = "hello"
For $n = 0 To UBound($a) - 1
    Assign("var" & $n, $a[$n])
Next
MsgBox(0, "test", "Testing $b$ and $var0$ and $var1$ and $var2$ gives me the correct substitution!")

:shocked:

very good workaround :(
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

It's not so bad. You did it in six lines, I did it in 6 lines...

Opt("ExpandVarStrings", 1)
Dim $a[3] = ["text1", "text2", "text3"], $b = "hello"
For $n = 0 To UBound($a) - 1
    Assign("var" & $n, $a[$n])
Next
MsgBox(0, "test", "Testing $b$ and $var0$ and $var1$ and $var2$ gives me the correct substitution!")

:shocked:

Good idea, thanks! Some tweaking (I have sledgehammers and power drills hanging around here somewhere for tweaking) and this can be put to work, so I can still save time! :(

Thanks again.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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