# 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:

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

##### Share on other sites

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:

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:

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.

##### Share on other sites

Yup, that fixed it.

"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

##### Share on other sites

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.

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

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