Archive

Archive for the ‘Articles’ Category

SetWarningsOn function in RoutineBot

June 18th, 2009

Function SetWarningsOn enables or disables Exceptions searching. If these function is enabled, then after each event or function Interpreter will be search an error window, and if this window is found then to it sends event, that emulates click on ‘OK’ botton.

Interpreter finds 2 kinds of error symptoms

1)  Window that caption contains string ‘Access violation’

or

2) Window, that contains error icon.

E.g. in Windows XP it look so   error xp

and In Vindows Vista it look so  errorvista

Syntax

SetWarningsOn( WarningsON:String )

Parameters

WarningsON:String

If  WarningsON is 1 or ‘ON’ then function enables exceptions searching, otherwise if WarningsON is 0 or ‘OFF’ then function disables exceptions searching.

Example

For this example you must download errorsample application, that raises an exception.
SetWarningsOn('ON');
Execute('c:\ErrorSample.exe');
Wait(1000);
ClickButton('Run divide error');
//error, cathed
SetWarningsOn('OFF');
ClickButton('Run divide error');
//error, not cathed

Download example SetWarningsOn

  • Share/Bookmark

Developer Articles

WriteText function in RoutineBot

June 18th, 2009

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

  • Share/Bookmark

Developer Articles

IncludeIniFile function in RoutineBot

June 18th, 2009

Syntax

IncludeIniFile( FileName:String )

Parameters

FileName:String

Full path to file with params

Return value

If file exists function return 1, otherwise function return 0.

Remarks

With function IncludeIniFile you can read some parameters from file. Parameters must be represent in format <key>=<value>. E.g. after including file, with content
a=1
s=some text

you become in scrtipt 2 variables : a:integer with value 2 and s:string with value ’some text’.

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’.

IncludeIniFile('c:\sometext.txt');
MSGBox('i = ' + ToString(i));
MSGBox('s = ' + s);

Download example IncludeIniFile.

  • Share/Bookmark

Developer Articles