Vicon Shogun banner

Description

Runs a script snippet or script file.

In Shogun Post, you normally have one script execute another script just by providing the script name of one of the script files in your script directories. However, sometimes you want to construct a script "on the fly" by composing a string that contains the script contents. This command allows you to execute the contents of a string. It also allows you to execute a script file which may not exist within your script directories.

Functional area

System

Command syntax

Syntax

runScript "script"[-file] [-noFail]

Arguments

NameTypeRequiredComments
scriptstringyesEither a small script snippet (e.g. print "Hello"; or a full path to a script file to execute.
Note that all file paths in Shogun Post HSL scripting use forward slashes instead of back-slashes.

Flags

NameFlag argumentsArgument typeExclusive toComments
file0Specifies that the "script" is a file path rather than a script snippet.
noFail0Specifies that this command (causing the script which calls it to fail) if the execution of "script" fails. The command will then return true or false depending on the successful completion of "script".

Return value

boolean

If the -noFail flag is specified, returns whether the script successfully ran. Otherwise always returns true.

Examples

// Execute a small script which just prints "Hello World" to the 
// command log.
string $str = "Hello World";
runScript $str;

// Alternatively run a script that is in your temp folder
// and find out whether it ran successfully.
boolean $wasSuccessful = `runScript "C:/Temp/MyScript.hsl" -file -noFail`;
print $wasSuccessful;

Additional information

Related commands