Ticket #570: FilenameTest.au3

File FilenameTest.au3, 1.7 KB (added by anonymous, 16 years ago)
Line 
1; -----------------------------------------------------------------------
2Opt("ExpandVarStrings", 1)      ;0=don't expand, 1=do expand
3; Filename table
4Global $MaxFilenames = 5
5Global $Filename[5]
6; ALL FILENAMES IN THIS TABLE WILL IN THE END BE CREATED WITH ONLY ONE DOLLAR ($) SIGN LEFT!!
7; SHOULD Opt("ExpandVarStrings", 1) WORK THIS WAY? AutoIt is analyzing the CONTENTS of variabels
8; and changes them if $ is found. I thought Opt was a compiler directive telling the compiler to interpret
9; literals and variabel names in the AutoIt language only. Not the contents of variabels when running
10; the script!!
11; Literal strings are not = variabel contents!!!!!!!!!!!!!!!
12$Filename[0] = "1cbep§bnk.txt"             ;
13$Filename[1] = "2cbep§§bnk.txt"            ;
14$Filename[2] = "3cbep§§§bnk.txt"           ;
15$Filename[3] = "4cbep§§§§bnk.txt"          ;
16$Filename[4] = "5cbep$$$$$$$$$$bnk.txt"    ;
17; End of Filename table
18 
19$dira = @WorkingDir&"\"
20Global $WRITE = 1
21   
22For $IX = 0 to $MaxFilenames - 1
23    $Filename[$IX] = StringReplace($Filename[$IX],"§","$")
24    $origfilename = $Filename[$IX]
25MsgBox(4096, "MSG 1", "$$Filename $IX$ = "&$Filename[$IX]&" $$origfilename = $origfilename$")   ; DEBUGD
26    If FileExists($origfilename) Then
27       FileDelete($origfilename)
28    Endif
29    $myfile=FileOpen($origfilename, $WRITE)
30    $longfilename = FileGetLongName($dira&$origfilename)
31    $errorstat    = @error
32    $msg = "File $$IX=$IX$ $$origfilename=$origfilename$ $$longfilename=$longfilename$ $$errorstat = $errorstat$"&@CRLF
33    FileWrite($myfile,$msg)
34    $msg = "$$Filename $IX$ = "&$Filename[$IX]&" $$origfilename = $origfilename$"
35    FileWrite($myfile,$msg)
36    FileClose($myfile)
37Next