272
Chapter 14 Scripting the Visual Tools Object Model
breaks. The function returns a status code that can be investigated to determine the
success of the operation.
Example
Sample Add script
function Main () {
var hsOKInfo = 64;
var app = Application;
var ZIPPro = app.ZIPProvider;
//Identify the files to be compressed
var ZIPFiles = ‘d:\\projects\\hs4\\scripts\\test.htm’;
ZIPFiles = ZI ‘\n’ + ‘d:\\projects\\hs4\\scripts\\test.zip’;
ZIPFiles = ZI ‘\n’ + ‘d:\\projects\\hs4\\scripts\\*.js’;
//Add method options
var bRecurse = true;
var bIncludeDirInfo = true;
var bIncludeHidden = true;
var bIncludeVolume = false;
//Create the ZIP file and execute Add method
ZIPPro.ZipFile = ‘d:\\newzips\\newarchive.zip’;
var nStatusCode = ZIPPro.Add( ZIPFiles , bRecurse, bIncludeDirInfo,
bIncludeHidden, bIncludeVolume );
//Interpret and display the return code
var sMessage = ‘’;
if (nStatusCode == 0){sMessage = "Operation Succesful";}
else if (nStatusCode == 10){sMessage = "General Warning";}
else if (nStatusCode == 0){sMessage = "Success";}
else if (nStatusCode == 10){sMessage = "WarningGeneral";}
else if (nStatusCode == 30){sMessage = "WarningNoZipFile";}
else if (nStatusCode == 40){sMessage = "WarningFilesSkipped";}
else if (nStatusCode == 50){sMessage = "WarningEmptyZipFile";}
else if (nStatusCode == 100){sMessage = "ErrorNoZipFile";}
else if (nStatusCode == 110){sMessage = "ErrorZipStruct";}
else if (nStatusCode == 120){sMessage = "ErrorMemory";}
else if (nStatusCode == 130){sMessage = "ErrorBadCall";}
else if (nStatusCode == 140){sMessage = "ErrorNothingToDo";}
else if (nStatusCode == 150){sMessage = "ErrorDiskFull";}
else if (nStatusCode == 160){sMessage = "ErrorEOF";}
else if (nStatusCode == 180){sMessage = "ErrorLibInUse";}
else if (nStatusCode == 190){sMessage = "ErrorUserAbort";}
else if (nStatusCode == 200){sMessage = "ErrorTestFailed";}
else if (nStatusCode == 210){sMessage = "ErrorZeroTested";}
else if (nStatusCode == 240){sMessage = "ErrorDLLNotFound";}
else if (nStatusCode == 250){sMessage = "ErrorInternalLogic";}
else if (nStatusCode == 280){sMessage = "ErrorTempFile";}
else if (nStatusCode == 290){sMessage = "ErrorRead";}
else if (nStatusCode == 300){sMessage = "ErrorWrite";}
else if (nStatusCode == 310){sMessage = "ErrorCantCreateFile";}
else if (nStatusCode == 350){sMessage = "ErrorParentDir";}
else if (nStatusCode == 370){sMessage = "ErrorNameRepeat";}
else if (nStatusCode == 380){sMessage = "ErrorLatest";}
else if (nStatusCode == 400){sMessage = "ErrorDOSError";}
Содержание ColdFusion Server 5
Страница 18: ...xviii About This Book...
Страница 26: ...8 Chapter 1 Setting Up the Product...
Страница 42: ...24 Chapter 2 Configuring Browsers and Servers...
Страница 60: ...42 Chapter 3 Exploring the Workspace...
Страница 100: ...82 Chapter 6 Editing Pages...
Страница 126: ...108 Chapter 7 Using Web Development Languages...
Страница 212: ...194 Chapter 13 Customizing the Development Environment...
Страница 320: ...302 Glossary...