Text File - Insert Line

Inserts a line of text into a file at a specific line number.

Action ID:
Action Category:
Action List Syntax:

59
Text File
TextFile.InsertLine (<<FILENAME>>, <<TEXT>>, <<LINENUMBER>>)

Settings

File name:

The full path and filename of the text file.

Insert new line at position (-1 for end of file):

The zero-based line number where the line of text will be inserted. Use -1 to append the line to the end of the text file.

Line to insert:

The line of text that will be inserted into the text file.

Error Codes

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

MSG_ERR_INSERT_TEXT_LINE

MSG_ERR_INSERT_TEXT_LINE
MSG_ERR_FILE_NOT_FOUND
<<FILENAME>>

2

MSG_ERR_INSERT_TEXT_LINE

MSG_ERR_INSERT_TEXT_LINE
MSG_ERR_OPENING_FILE
<<FILENAME>>

3

MSG_ERR_INSERT_TEXT_LINE

MSG_ERR_INSERT_TEXT_LINE
MSG_ERR_FILE_TOO_LARGE
<<FILENAME>>

4

MSG_ERR_INSERT_TEXT_LINE

MSG_ERR_INSERT_TEXT_LINE
MSG_ERR_LINE_OUT_OF_RANGE
<<LINENUMBER>>

<<FILENAME>>

5

MSG_ERR_INSERT_TEXT_LINE

MSG_ERR_INSERT_TEXT_LINE
MSG_ERR_WRITE_TEXT_FILE
<<FILENAME>>

Examples

Inserting a line in a text file