Jump to content

generating text files with predetermined text


Recommended Posts

Have no idea where you saw the code above it's not in the help file, to write the code above you could use either:

#include <FileConstants.au3>
Local $sExample1 = @ScriptDir & "\Example1.txt"
Local $hExample1 = FileOpen($sExample1, $FO_OVERWRITE) ;~ Overwrites the file if it exists
FileWrite($hExample1, "overwrite example test 123" & @CRLF)
FileClose($hExample1)

;~ Open the file to read it
ShellExecute($sExample1)

;~ Or

Local $sExample2 = @ScriptDir & "\Example2.txt"
Local $hExample2 = FileOpen($sExample2, $FO_APPEND) ;~ Append to the file if it exists
FileWrite($hExample2, "append example test 123" & @CRLF)
FileClose($hExample2)

;~ Open the file to read it
ShellExecute($sExample2)

;~ Or

FileWrite(@ScriptDir & "\Example3.txt", "example test 123" & @CRLF)
ShellExecute(@ScriptDir & "\Example3.txt")

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...