ExternalVBScript.Script PropertySets the Script value for an ExternalVBScript object.object.getScript object.setScript(newvalue) Arguments
RemarksThe Script property contains the actual VBScript code to run.The following example illustrates the use of the Script Property. // Create the array to store the arguments.
var arr = new Array();
// Enter the arguments in name-value pairs.
arr.push("Filter");
arr.push("Text Files|*.txt|Excel Files|*.xls|All Files|*.*");
arr.push("initdir");
arr.push("C:\\AAWork");
// Create an ExternalVBScript object.
var o = new ActiveDocument.ExternalVBScript(g_strUserTempPath, "OpenFileDialog.vbs", strOFDlgVBS, arr, 60, true);
// set the script text
o.setScript = "MsgBox \"The script string was not set.\"";
Alert(o.getScript);
// set the timeout property
o.setTimeout(0);
// Write the script to a file.
o.WriteScript();
// Run the script and get the results.
var sFile = o.RunScript();
// Use the results.
var sContent = ReadTextFromFile(sFile);
// Reset the properties of the ExternalVBScript
// object and delete its associated files.
o.Reset();
Applies To:ExternalVBScript ObjectRequirements |