# Variable name generation

## Recommended Posts

Hello to anyone who is willing to reply and/or help me with this This is my first post on this forum! I am trying to generate variable names, but having one of those "can't compute" moments.

```While 1
(\$arr & \$x)[1]
While \$n < 3000
If @error = -1 Then
(\$arr & \$x)[0] = UBound((\$arr & \$x)) - 1
ToolTip("Removing Dupes from array # " & \$x, 20, 20, "", 1, 4)
_Array1MakeUnique((\$arr & \$x))
\$n = 1
While \$x > 0
For \$n = 1 To (\$arr & \$x)[0]
ReDim (\$arr & \$x)[\$n + 1]
(\$arr & \$x)[\$n] = \$line
ToolTip(\$n, 20, 20, "Lines read into main array from array # " & \$x, 1, 4)
Next
\$x -= 1
WEnd
\$arr[0] = UBound(\$arr) - 1
ExitLoop(2)
EndIf
ReDim (\$arr & \$x)[\$n + 1]
(\$arr & \$x)[\$n] = \$line
ToolTip(\$n, 20, 20, "Lines read into array", 1, 4)
\$n += 1
WEnd
(\$arr & \$x)[0] = UBound((\$arr & \$x)) - 1
ToolTip("Removing Dupes from array # " & \$x, 20, 20, "", 1, 4)
_Array1MakeUnique((\$arr & \$x))
\$n = 1
\$x += 1
WEnd```

Code isn't tested since I can't even get the variable declaration going right. I thought that maybe it is possible to do smth like \$tmpArr = String("\$arr" & \$x), but that would just assign a value to that variable, which I don't need at all How would I go about creating legitimate variable titles for my arrays? Btw, the purpose for this script (didn't paste all of it here) is to remove dupes from a 30+MB text file that has quite a mess with dupes. If you have a suggestion that would make this code "simpler", throw it at me too Thanks!

[font="Comic Sans MS"]It's my first day.[/font]View and move images to subdirectories by pressing a key in XnView

Eval.

##### Share on other sites

Well, I was thinking yesterday about what I posted here and maybe I can just use 2 arrays and throw data into the main array after working on a small chunk of it in the temporary array. I guess my mind was stuck on the idea where I wanted to have more proficiency by somehow splitting the file into chunks and working on them at the same time, but it is still crazy to do that with my skill, if I can even call that so. Thanks for the Eval! I don't know how I didn't find it in autoit help before

[font="Comic Sans MS"]It's my first day.[/font]View and move images to subdirectories by pressing a key in XnView

##### Share on other sites

Well, I was thinking yesterday about what I posted here and maybe I can just use 2 arrays and throw data into the main array after working on a small chunk of it in the temporary array. I guess my mind was stuck on the idea where I wanted to have more proficiency by somehow splitting the file into chunks and working on them at the same time, but it is still crazy to do that with my skill, if I can even call that so. Thanks for the Eval! I don't know how I didn't find it in autoit help before

You could also use a scripting dictionary.

##### Share on other sites

Well, I was thinking yesterday about what I posted here and maybe I can just use 2 arrays and throw data into the main array after working on a small chunk of it in the temporary array. I guess my mind was stuck on the idea where I wanted to have more proficiency by somehow splitting the file into chunks and working on them at the same time, but it is still crazy to do that with my skill, if I can even call that so. Thanks for the Eval! I don't know how I didn't find it in autoit help before

You have to use Assign and Eval together. But they are both evil, and your idea of using arrays, or a scripting.dictionary are much better!

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 on other sites

Mmm, I think I will stay away from scripting dictionary for now; it scares me XD I will probably stick to using Eval and simpler code Thanks for the tips guys!

[font="Comic Sans MS"]It's my first day.[/font]View and move images to subdirectories by pressing a key in XnView

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...