Guest Ancient Orange Posted July 30, 2004 Share Posted July 30, 2004 Hi folks!I've got a little bit of a problem here i am currently programming a script and i need the possibility of opening Files which contain non alpha numeric characters (such as spaces for example).so here is my script.$txt2 = Fileopen($rootfiledir&"\"&$Dir&"\info.txt", 2)so if $dir is something like:abcd everything works fine but if $Dir is something like "a folder" its got problems with opening the info.txt.I really hope someone can give me a hand with this problem since the programm must work today when i show it to my boss.Greeting Ancient Link to comment Share on other sites More sharing options...
ezzetabi Posted July 30, 2004 Share Posted July 30, 2004 FileOpen() should not have any problem with strange chars... Link to comment Share on other sites More sharing options...
pekster Posted July 30, 2004 Share Posted July 30, 2004 The following code works for me: $drive = @HomeDrive $folder = "a folder name" DirCreate($drive & "\" & $folder) $test = FileOpen($drive & "\" & $folder & "\test.txt", 2) FileWrite($test, "this line is a test line") FileClose($test) Run('notepad.exe "' & $drive & "\" & $folder & '\test.txt"') WinWaitActive("test.txt") While WinExists("test.txt") Sleep(100) WEnd If MsgBox(4, "remove temp files", "would you like to remove the " & _ "temporary file and directory created?") = 7 Then Exit FileDelete($drive & "\" & $folder & "\test.txt") DirRemove($drive & "\" & $folder) [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
w_sp8er Posted July 31, 2004 Share Posted July 31, 2004 try $txt2 = Fileopen('"' & $rootfiledir & '\' & $Dir & '\info.txt"', 2) Link to comment Share on other sites More sharing options...
sugi Posted August 2, 2004 Share Posted August 2, 2004 A filename (in windows) must not contain a character like " so no program would be able to open that file. But I guess you want to open a file called $rootfiledir & '\' & $Dir & '\info.txt' 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