Jump to content
Sign in to follow this  
Guest Ancient Orange

Fileopen

Recommended Posts

Guest Ancient Orange

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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'

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...