Write To File Action

Description

Writes the data specified to a file. The data is either overwriting the file or is appended to the end of the file.

Declaration

<AMFILEWRITE FILE="text" DATA="text" APPEND="yes/no" BYTESVARIABLE="text">

Example

<AMFILEWRITE FILE="C:\test.txt" WRITEDATA="This is the text I want to write to the end of the file" VARIABLENAME="varname">

General Tab Parameters

File: Specifies the file(s) that the data should be written to.

Text, Required
MARKUP: FILE="c:\sourcefoldername\file.txt"

Method: Overwrite file or Append at the end of the file: Specifies whether the data should be appended to the end of the file as a new line or should overwrite all the data in the file.

Yes/No, Optional Default= YES
MARKUP: APPEND="NO"

Data to write: Specifies the data to write to the file. As with every text parameter, if the data you wish to write is contained in a variable simply type the variable name surrounded by percentage signs to resolve it to its contents at runtime (e.g. %varname%).

Text, Required
MARKUP:
a) DATA="Text to be written goes here"

b) DATA="%varname%"

Advanced Tab Parameters

Populate variable with number of bytes written: Specified the name of the variable to populate with the number of bytes that were written to the file. The variable must have been created using a Create Variable <AMCREATEVAR> previous step.

Text, Required
MARKUP: BYTESVARIABLE="varname"

See Also

Copy File, Move File, Delete File, Delete Folder, Rename Folder