How To Use VBScripts as Event Scripts in Wise Composer

Article:HOWTO60862  |  Created: 2011-11-16  |  Updated: 2011-11-16  |  Article URL http://www.symantec.com/docs/HOWTO60862
Article Type
How To



  1. Create your event script.  Below is a sample script template that is capable of returning a success or failure to the results file (event script will not run successful without a result returned):
  '**************  
 
'Add your script here
 
'**************
 

'Uncomment the required line below to return a success or failure:
 
' SetResult true,""
 
'SetResult false, "An error happened and this is my custom message"

 
Sub SetResult(bolSuccess, strMessage)
 
    Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim objResultsFile: Set objResultsFile = objFSO.OpenTextFile(WScript.Arguments.Item(0), 2, True)
 
    If bolsuccess = true then
        objResultsFile.WriteLine "1"
 
    Else 
 
        objResultsFile.WriteLine "0"
        If strMessage <> "" Then objResultsFile.WriteLine strMessage
 
    End If
    objResultsFile.Close
 
End Sub
  1. Add your VBScript as a Data event within composer (when browsing for the file you will need to select All Files)
  2. Create another event script where you would like the script to be executed
  3. Type in or browse to the path of either wscript.exe or cscript.exe in the System32 folder (SysWOW64 folder if you need a 32 bit scripting engine on a 64 bit platform)
  4. In the Parameters field, type the name of your VBScript followed by the $scriptresult$ parameter (contains results-file path) and any additional parameters your script requires.  Example is given below (take note of the quotation marks):

"MyEventScript.vbs" "$scriptresult$"
  1. Ensure that you do not select the Bundle Script Executable with Package option as this will include the scripting engine with your package
  2. Set all other options as required

Important note:  If your event script is set to run using the system account by not selecting Run with User Privileges (non-system account),  then any dialogs that your script produces will be hidden and the event will appear to 'hang'.



Article URL http://www.symantec.com/docs/HOWTO60862


Terms of use for this information are found in Legal Notices