n9mfk9 Posted December 6, 2007 Share Posted December 6, 2007 hi every one I need help with an array here is my code expandcollapse popup#include <String.au3> #include <array.au3> $file = FileOpen("wxlocal.html", 0) $fileout = FileOpen("test1.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, '%', '%');Not using SRE ;MsgBox(0, "Line read:", $aArray1) If NOT @ERROR Then ;_ArrayDisplay($aArray1, 'Default Search') $a=@CRLF&"|%" $test = _ArrayToString($aArray1,$a) ;$test= StringReplace($test," ","t") $begin= "|%" $end ="%" $output= $begin&$test&$end FileWrite($fileout,$output&@CRLF) ;MsgBox(0, "Line read:", $output) EndIf WEnd FileClose($fileout) FileClose($file) here is the output i get if there is 1 item found on a line |%tempnodp% were I am have trouble is if there is more then one item on a line i get |%heatcolourword |%weathercond |%downloadedmetar1vis% how can i change my code so no matter what it put a % on the end thanks Beau Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 6, 2007 Share Posted December 6, 2007 (edited) Perhaps with this: $aArray1 = _StringBetween($line, '%', '%');Not using SRE If Not @error Then For $a = 0 To UBound($aArray1) - 1 $aArray1[$a] = "%" & $aArray1[$a] & "%" Next $a = @CRLF & "|" $output = "|%" & _ArrayToString($aArray1, @CRLF & "|%") FileWrite($fileout, $output & @CRLF) EndIf Edited December 6, 2007 by PsaltyDS 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now