Jump to content

Recommended Posts

Posted

i want to know how to generate text files with predetermined text

eg: text.txt is generated and the text hello test 123 coding is fun is writen to test.txt

how do i do that?

Posted
1 minute ago, Subz said:

Look in the help file for FileWrite it includes an example.

here its writing a log output which is not predetermined

FileWrite($Desktopdir & "\log.txt", "Decrypted files: " & @CRLF & @CRLF & $read_decrypted)

i want to use a predetermined text aka hardcoded

example test 123 written to test.txt

Posted

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")

 

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
  • Recently Browsing   0 members

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