n9mfk9 Posted January 30, 2008 Posted January 30, 2008 (edited) Hi everyone here my code expandcollapse popup#include <array.au3> #include<File.au3> $tagname ="" $ext =".txt" $sInput = "" ;$tagname = "" $FileIn = @ScriptDir & "\tagslist"&$ext $Fileout = @ScriptDir & "\mytest"&$ext ;$hFileOut = FileOpen($FileOut, 2) $sInput = FileRead($FileIn, FileGetSize($FileIn)) If @error = 1 Then MsgBox(0, "Error", "Unable to open file."&$FileIn) Exit EndIf ;MsgBox(0,"test", $FileIn) $avInput = StringSplit($sInput, @CRLF, 1) ;_ArrayDisplay($avInput, "$avInput") Global $avOutput[$avInput[0] + 1] = [$avInput[0]] For $n = 1 To $avInput[0] $sFormatted = "" $tag = StringRegExp($avInput[$n], "%.*?%", 1) If @error = 0 Then ;$tagname = $tag[0] Global $tagname[Ubound($tag)] $tagname[0] = $tag[0] $tagname[0] = StringReplace($tagname[0],'-','_') $tagname[0] = StringReplace($tagname[0],'<','LT') $tagname[0] = StringReplace($tagname[0],'>','GT') $tagname[0] = StringReplace($tagname[0],'=','') $tagname[0] = StringReplace($tagname[0],'/','_') $tagname[0] = StringReplace($tagname[0],',','CM') ;MsgBox(0,"",$tagname) ; ConsoleWrite("Debug: " & $n & ": " & $tag[0] & @LF) $sFormatted = "$" & StringReplace($tagname[0], "%", "") & ' = "' & $tag[0] & '" ' ;MsgBox(0,"",$sFormatted) ;ConsoleWrite("Debug: $sFormatted = " & $sFormatted & @LF) EndIf $avOutput[$n] = $sFormatted & "\\ " & StringRegExpReplace($avInput[$n], "\.{2,}", "", 0) ; ConsoleWrite("Debug: Output " & $n & ": " & $avOutput[$n] & @LF) Next Dim $avohdr $avohdr= _ArrayCreate("<?php" & @CRLF & "// converted"& $FileIn& "to"& $FileOut & "for php tags" & @CRLF & _ "// by " & "// Author: n9mfk" & @CRLF & "//// ---------------------------------" & @CRLF & _ "// allow viewing of generated source"&@CRLF&@CRLF&"if ( \$_REQUEST['sce'] == 'view' ) {" & @CRLF & _ " download('view');"& @CRLF & "exit;}"&@CRLF) _ArrayDisplay($avohdr, "$avOutput") $hFileOut = FileOpen($FileOut, 2) _FileWriteFromArray($hFileOut, $avohdr,0) _FileWriteFromArray($hFileOut, $avOutput,1) FileClose($hFileOut) ;MsgBox(0,"test", $avOutput) ;_ArrayDisplay($avOutput, "$avOutput") here the code i need help with Dim $avohdr $avohdr= _ArrayCreate("<?php" & @CRLF & "// converted"& $FileIn& "to"& $FileOut & "for php tags" & @CRLF & _ "// by " & "// Author: n9mfk" & @CRLF & "//// ---------------------------------" & @CRLF & _ "// allow viewing of generated source"&@CRLF&@CRLF&"if ( \$_REQUEST['sce'] == 'view' ) {" & @CRLF & _ " download('view');"& @CRLF & "exit;}"&@CRLF) _ArrayDisplay($avohdr, "$avOutput") $hFileOut = FileOpen($FileOut, 2) _FileWriteFromArray($hFileOut, $avohdr,0) when i look at my file the <?php is printed on lne 2 line 1 ins blank how can i move it to line 1 thanks Beau Edited January 30, 2008 by n9mfk9
PsaltyDS Posted January 30, 2008 Posted January 30, 2008 here the code i need help with Dim $avohdr $avohdr= _ArrayCreate("<?php" & @CRLF & "// converted"& $FileIn& "to"& $FileOut & "for php tags" & @CRLF & _ "// by " & "// Author: n9mfk" & @CRLF & "//// ---------------------------------" & @CRLF & _ "// allow viewing of generated source"&@CRLF&@CRLF&"if ( \$_REQUEST['sce'] == 'view' ) {" & @CRLF & _ " download('view');"& @CRLF & "exit;}"&@CRLF) _ArrayDisplay($avohdr, "$avOutput") $hFileOut = FileOpen($FileOut, 2) _FileWriteFromArray($hFileOut, $avohdr,0) when i look at my file the <?php is printed on lne 2 line 1 ins blank how can i move it to line 1 thanks Beau This is actually a problem with the _FileWriteFromArray() function. The relevant part of the function is this: ; Write array data to file Local $ErrorSav = 0 For $x = $i_Base To $i_UBound If FileWrite($hFile, @CRLF & $a_Array[$x]) = 0 Then $ErrorSav = 3 ExitLoop EndIf NextoÝ÷ Ùhbr§±êí²Ø^ì%wªÁSæé^éí¡ûayªëk+âqàLDX¢çÜjKajÖòë-yØx2¢êßW»u©Ýr§)ඨébëhjëh×6 If FileWrite($hFile, $a_Array[$x] & @CRLF) = 0 Then I think that make more sense, too. 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
PsaltyDS Posted January 30, 2008 Posted January 30, 2008 Looks like it's already fixed in 3.2.11.0 Beta. 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
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