User Guide
268 Chapter 14 Scripting the Visual Tools Object Model
The following error messages are predefined. Check for the error strings to detect
these error cases:
• File already exits—Returned when file specified in FilePath exists and
bOverwrite is set to False.
• Path does not exist—Returned when the path specified in
FilePath does not
exist.
Example
Sample download script
//*******************************************//
// This script downloads a ZIP file using
// SaveReceivedStreamToFile
//*******************************************//
function Main () {
var hsOKInfo = 64;
var app = Application;
var httpPro = app.HTTPProvider;
httpPro.URL = "http://127.0.0.1/test.zip";
httpPro.Get();
var bOverwrite = false;
var sErrorMsg =
httpPro.SaveReceivedStreamToFile("d:\\downloads\\test.zip",
bOverwrite );
if ( sErrorMsg != "" )
{
app.MessageBox( "A error occured :" + sErrorMsg ,"HTTPProvider
Error", hsOKInfo);
}
}
URLEncode
Syntax URLEncode(const wsValue: WideString): WideString;
Description Returns a URLEncoded form of the wsValue string. Use this function when
populating URL or FORM data.