VBScript.Begin..End
Top  Previous  Next


Use the VBScript.Begin..End structure to run VBScript commands

Requirements
Windows Scripting Host (WSH) is required in order to use VBScript commands in SetupBatcher. Learn more about WSH here: Windows Script Technologies.

Category
General

Script section
All

Instructions
·Surround all VBScript commands with "VBScript.Begin" and "VBScript.End".  
·Use SetupBatcher variables to pass parameters (input) to VBScript commands.  
·To get parameters (output, result) from a VBscript section, use VBscript commands (see Scripting.FileSystemObject) to write the parameters to a file, then use the SetupBatcher FileValue function to read from the file.  

Notice / limitations
·All VBScript commands are executed on the local machine.  
·It is not possible to insert comments by putting two slashes (//) in front of the comment text inside a VBScript.Begin..End statement. Instead, use a single quote (') like in VBScript.  
·Unlike other SetupBatcher commands - if an error occurs in a script and the script is restarted - the whole script within the current VBScript.Begin..End structure will be executed from the beginning.  
·SetupBatcher automatically inserts "On Error resume next" in scripts to trap errors. Do not try to add your own error handling.  
·JScript is currently not supported.  

Examples
1) VBScript msgbox

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
[Settings_End]

[Machines_Begin]
\\MAIN01      NT PDC    Ok-AllDone
[Machines_End]

[Batch_Begin]
VBScript.Begin   
 msgbox("Start of Script - Machine: %servername%")   
VBScript.End   
Data.Loop   
 VBScript.Begin   
  MyVar="Loop - %col2%"   
  msgbox(MyVar)   
 VBScript.End   
Data.Endloop   
[Batch_End]

[Data_Begin] 
   Item1
   Item2
[Data_End]


2) Add some useful icons to the desktop (of the local machine)

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
[Settings_End]

[Machines_Begin]
\\MAIN01   D09   NT PDC    Ok-AllDone
[Machines_End]

[Batch_Begin]
Data.Loop   
 VBScript.Begin   
  Set oS=Createobject("WScript.shell")   
  DesktopPath = oS.SpecialFolders("Desktop")   
  Set oL=oS.CreateShortcut(DesktopPath+"\%col1%.url")
  oL.TargetPath="%col2%"   
  oL.Save   
 VBScript.End   
Data.Endloop   
[Batch_End]

[Data_Begin]
AdmWin.com   http://www.admwin.com      
AltaVista   http://www.altavista.com
[Data_End]