Jump to content

A Problem I am Having with an Array


Recommended Posts

I am having one problem with the loop i use to index all the drives. This new indexing engine takes longer to index the drives, but like i said it is much faster at searching for files. I am having one problem though.

This is in a massive for loop. The full script is attached to this post.

$indexinput = StringSplit(StringTrimRight($indexinput, 1), @LF)
                _ArraySort($indexinput, False, 1)
                
                
                GUICtrlSetData($indexstatuslabel, "Compiling Index...")
                For $Z = 1 To $indexinput[0]
                    Local $Record = StringSplit($indexinput[$Z], @TAB)
                    If $Record[1] <> $CurrentFile Then
                        $fileoutput &= '[' & $Record[1] & ']' & @LF
                        $titleindex &= $Record[1] & @LF
                        $CurrentFile = $Record[1]
                    EndIf
                    $fileoutput &= $Record[2] & '=' & $Record[3] & @LF
                    
                    If $usercancel = "true" Then ExitLoop
                Next

I get this error:

Posted Image

Please keep in mind that the entire thing there is in a for loop. The first loop there are no problems, the next time it loops i get the error.

You can find the error on line 1309. I clear the variables, but i get that weird error. Not sure why. Any help would be appreciated.

You can see my full thread here:

http://www.autoitscript.com/forum/index.ph...=0entry137187

The full script is attached.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

  • Moderators

I am having one problem with the loop i use to index all the drives. This new indexing engine takes longer to index the drives, but like i said it is much faster at searching for files. I am having one problem though.

This is in a massive for loop. The full script is attached to this post.

$indexinput = StringSplit(StringTrimRight($indexinput, 1), @LF)
                _ArraySort($indexinput, False, 1)
                
                
                GUICtrlSetData($indexstatuslabel, "Compiling Index...")
                For $Z = 1 To $indexinput[0]
                    Local $Record = StringSplit($indexinput[$Z], @TAB)
                    If $Record[1] <> $CurrentFile Then
                        $fileoutput &= '[' & $Record[1] & ']' & @LF
                        $titleindex &= $Record[1] & @LF
                        $CurrentFile = $Record[1]
                    EndIf
                    $fileoutput &= $Record[2] & '=' & $Record[3] & @LF
                    
                    If $usercancel = "true" Then ExitLoop
                Next

I get this error:

Posted Image

Please keep in mind that the entire thing there is in a for loop. The first loop there are no problems, the next time it loops i get the error.

You can find the error on line 1309. I clear the variables, but i get that weird error. Not sure why. Any help would be appreciated.

You can see my full thread here:

http://www.autoitscript.com/forum/index.ph...=0entry137187

The full script is attached.

Does this help?

$indexinput = StringSplit(StringTrimRight($indexinput, 1), @LF)
                _ArraySort($indexinput, False, 1)
                
                
                GUICtrlSetData($indexstatuslabel, "Compiling Index...")
                For $Z = 1 To $indexinput[0]
                    Local $Record = StringSplit($indexinput[$Z], @TAB)
                    If IsArray($Record) Then
                        If $Record[1] <> $CurrentFile Then
                            $fileoutput &= '[' & $Record[1] & ']' & @LF
                            $titleindex &= $Record[1] & @LF
                            $CurrentFile = $Record[1]
                        EndIf
                        If $Record[0] >= 3 Then $fileoutput &= $Record[2] & '=' & $Record[3] & @LF
                    EndIf
                    
                    If $usercancel = "true" Then ExitLoop
                Next

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Yup, that fixed it. :P

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

  • Moderators

Good Deal... The first option (IsArray()) has gotten me out of alot of could be trouble, I use it with everything that 'could' / 'would' have an array just as a fail safe.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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