Jump to content

Variable name generation


Recommended Posts

Hello to anyone who is willing to reply and/or help me with this :D 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
            $line = FileReadLine($file)
            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 :D 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

Link to comment
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 :D

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

Link to comment
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 :D

You could also use a scripting dictionary.
Link to comment
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 :D

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!

:D

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

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