296
Chapter 15 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.
Example HTTPProvider script
//**********************************************//
// ActiveScripting example (JScript)
//**********************************************//
// This script contacts the site specified by the user URL,
// copies its source code and displays the page in the internal
// browser of the application
//**********************************************//
function Main (){
var sDocName;
var sSource;
var sMessage;
Summary of Contents for HOMESITE
Page 11: ...Contents xi Table of CommandID values 310 Table of SettingID values 314 Glossary 323...
Page 12: ...xii Contents...
Page 20: ...xx About This Book...
Page 28: ...8 Chapter 1 Setting Up the Product...
Page 70: ...50 Chapter 4 Managing Files...
Page 88: ...68 Chapter 5 Writing Code and Web Content...
Page 116: ...96 Chapter 6 Editing Pages...
Page 148: ...128 Chapter 7 Using Web Development Languages...
Page 190: ...170 Chapter 11 Deploying Files...
Page 210: ...190 Chapter 12 Testing and Maintaining Web Pages...
Page 216: ...196 Chapter 13 Extending the Help System...
Page 350: ...330 Glossary...
Page 358: ...338 Index...