Jump to content
Sign in to follow this  
n9mfk9

(25) : ==> Subscript used with non-Array variable ?

Recommended Posts

n9mfk9

Hi everyone herer is my code

This is the error i get (25) : ==> Subscript used with non-Array variable.:

$tag1[$a] = '%'& $aArray1[$a]&'%'

how can i fix this Thanks

#include <String.au3>
#include <array.au3>
Dim $tag1
Dim $tagname3

$file = FileOpen("tagslist.txt", 0)
$fileout = FileOpen("myphp.txt", 1)
;Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
   
    
    $aArray1 = _StringBetween($line, '%', '%')
    If Not @error Then
   ;  _ArrayDisplay($aArray1, 'Default Search')
    ;MsgBox(0,$aArray1)
        For $a = 0 To UBound($aArray1) - 1
            $tag1[$a] =  '%'& $aArray1[$a]&'%'
            $tagname3[$a] = $aArray1[$a]
            $tagname3[$a] = StringReplace($tagname3[$a],'-','_')
            $tagname3[$a] = StringReplace($tagname3[$a],'<','LT')
            $tagname3[$a] = StringReplace($tagname3[$a],'>','GT')
            $tagname3[$a] = StringReplace($tagname3[$a],'=','')
            $tagname3[$a] = StringReplace($tagname3[$a],'/','_')
            $tagname3[$a] = StringReplace($tagname3[$a],',','CM')
            
            FileWrite($fileout, $tag1[$a])
        ;MsgBox(0,'',$aArray1[$a])
        ;$aArray1[$a] = "" & $aArray1[$a] & "%"
        Next
      ; $a = @CRLF & "|"
       ;$output = "|%" & _ArrayToString($aArray1, @CRLF & "|%")
       ;FileWrite($fileout, $output & @CRLF)
    EndIf

WEnd    

FileClose($fileout)
FileClose($file)

Share this post


Link to post
Share on other sites
/dev/null

how can i fix this Thanks

without the file tagslist.txt, nobody can tell you!

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
slaughter

#include <String.au3>
#include <array.au3>
Dim $tag1[1]
Dim $tagname3[1]

$file = FileOpen("tagslist.txt", 0)
$fileout = FileOpen("myphp.txt", 1)
;Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
  
    
    $aArray1 = _StringBetween($line, '%', '%')
    If Not @error Then
_ArrayDisplay($aArray1, 'Default Search')
   ;MsgBox(0,$aArray1)
        For $a = 0 To UBound($aArray1) - 1
            ReDim $tag1[UBound($aArray1)]
            ReDim $tagname3[UBound($aArray1)]
            $tag1[$a] =  '%'& $aArray1[$a]&'%'
            $tagname3[$a] = $aArray1[$a]
            $tagname3[$a] = StringReplace($tagname3[$a],'-','_')
            $tagname3[$a] = StringReplace($tagname3[$a],'<','LT')
            $tagname3[$a] = StringReplace($tagname3[$a],'>','GT')
            $tagname3[$a] = StringReplace($tagname3[$a],'=','')
            $tagname3[$a] = StringReplace($tagname3[$a],'/','_')
            $tagname3[$a] = StringReplace($tagname3[$a],',','CM')
            
            FileWrite($fileout, $tag1[$a])
       ;MsgBox(0,'',$aArray1[$a])
       ;$aArray1[$a] = "" & $aArray1[$a] & "%"
        Next
     ; $a = @CRLF & "|"
      ;$output = "|%" & _ArrayToString($aArray1, @CRLF & "|%")
      ;FileWrite($fileout, $output & @CRLF)
    EndIf

WEnd    

FileClose($fileout)
FileClose($file)

problems:

1 variables was not set as array

2 Problem with array size :) Just redim it to a new size each time if you don't know what actual size is gonna be.

You are welcome

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.