WriteText function in RoutineBot

Syntax

WriteText( FileName:String, Text:String, Append:Integer [optional] )

Parameters

FileName:String

Full path to file

Text:String

Text to write

Append:Integer [optional]

If this param is 1  Text will be append to end of file. Otherwise, if this param is  0 file will be cleared and then Text will be writed. Default value is 0.

Example
For these example you must create text file with content
i=1
s=Hello world!

(or download it from here)
and save it as ‘c:\sometext.txt’.

nl := NewLine + NewLine;
s := GetFileContent('c:\sometext.txt');
MsgBox('old file content'+ nl + s);
WriteText('c:\sometext.txt',NewLine + 'c=3',1);//adding text to file
s := GetFileContent('c:\sometext.txt');
MsgBox('file content after append string'+ nl + s);
WriteText('c:\sometext.txt','new textfile content');//rewriting text in file
s := GetFileContent('c:\sometext.txt');
MsgBox('file content after rewriting'+ nl + s);

Download example WriteText

Posted in Articles
Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Example: GUI test with RoutineBot

RoutineBot is testing GUI, trying to enter various values into the text fields and processing warning messages that tested program shows.

Gui Test Automation

GUI Testing TipsCheck out our GUI Test Automation tips.
Test Automation Step-by-Step
Learn more than 99% users know about test automation! Subscribe to maillist now! Learn how to create scripts that will do routine job for you.

Email: