Script examples

Execute Script

Automation Workshop includes Execute script Action that allows integration of JScript, VBScript and PowerShell scripts as well as batch files directly into the Task.

The script examples provided here will give a good insight how to use various scripts to create custom automation within the feature rich framework of Automation Workshop.

The scripting in Execute script Action of Automation Workshop has its own specifics. First, it must be noted that the script takes its input from Variable Wizard dynamic values. Everywhere a variable is required, a dynamic value has to be added directly to the script code.

Second, the data communication with other scripts is based on screen output. The screen output of the script can be retrieved by using Variable Wizard from subsequent Execute script Action. It is possible to retrieve either full screen output or any of the first six output lines separately.

And finally, as the window of the script in execution is not visible, the scripting support in Execute script Action is limited to non-interactive scripts (i.e. scripts that do not require user interference for their completion). If, however, the script will ask for user input or other interaction, the result will be undefined. When use of interactive scripts is necessary, try using Run DOS / Cmd command Action.

Execute script Action supports JScript (view examples).

JScript notes
  • JScripts do not support Unicode encoding.
  • JScripts support does not need to be setup in advance. It is built into system.

Execute script Action supports VBScript VBScript (view examples).

VBScript notes
  • VBScripts do not support Unicode encoding.
  • VBScripts support does not need to be setup in advance. It is built into system.

Execute script Action supports PowerShell scripts (view examples).

PowerShell notes
  • PowerShell scripts requires PowerShell 2.0 to be installed. On older operating systems PowerShell has to be installed by using Windows update or enabled in Programs and Features in Control Panel.
  • PowerShell supports Unicode. However, it has to be enabled individually in each script, by starting the script with the following code (for PowerShell version 1 and version 2):
    [Console]::OutputEncoding = [Text.Encoding]::Utf8
PowerShell notes · (only for Automation Workshop v2.2 and below)
  • By default, the execution policy of PowerShell scripts is restricted in such a way that no script can be executed. Before starting to use PowerShell scripts, a simple one-time operation has to be performed. The Set-ExecutionPolicy parameter has to be changed. PowerShell has to be run as administrator privileges (just running from administrator account is not sufficient). Type the following code into the PowerShell window:
    Set-ExecutionPolicy Unrestricted
  • If 32-bit Automation Workshop is run on 64-bit Windows, the PowerShell path is:
    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
  • In other cases, the PowerShell path is:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • It is possible to create an Automation Workshop Task which automatically sets Set-ExecutionPolicy to Unrestricted by running an Action which performs PowerShell.exe -command and sets required execution policy from batch file script.

Execute script Action includes Batch file support (view examples).

Batch file notes
  • In order to avoid unnecessary command echoing, it is recommended to start batch file code with:
    @Echo off
  • Batch files support does not need to be setup in advance.
  • Batch file scripts do not support Unicode encoding.

While the scripting support is very versatile and allows achieving almost unlimited results, due to script complexities, it is better regarded as a workaround for cases where the standard features of Automation Workshop can not yet provide a friendly and easy solution.

Start Program / Application
Start Program / Application
Run DOS / Cmd Command
Run DOS / Cmd Command
Open Document
Open Document
Free trial 15 day trial · Details…
Buy now 30 day MBG · Details…

If you have any questions, please do not hesitate to contact our support team.

© 2001–2018 Febooti Ltd.