Vicon Shogun banner

In order to perform many Shogun Post scripting operations or to create custom Shogun Post user windows, you must know how to work with values returned by commands:

Use left-hand single quotation marks

One way to return the value of a command is to enclose a command within left single quotation marks. You can then assign the enclosed command to a variable and display the result in the Log.

Tip
To create a left single quotation mark (`), press the key to the left of the number 1 on your keyboard.


For example:

// Define a variable called $a
string $a;
// Set $a to the value returned by the get property command
$a = `getProperty Name LFHD`;
// Print the return value to the Log.
print( $a );

This script prints the contents of $a, LFHD in this case, to the Log. In the example above, the getProperty command returns a string. Therefore, the variable on the left side of the equal sign must also be a string to accept this return value.

In the following example, left single quotation marks are used to define a user window:

int $dlg;
int $textBox;
// Create the user window. Call it "Test User Window"
$dlg = `createWindow "Test"`;
// Create the Text Box User Control, adding it to User Window we just created
$textBox = `createTextBox $dlg`;

Use C calling convention

As an alternative to using left-hand single quotation marks, you can also return values from Shogun Post commands using a C function syntax in order to collect a return value:

$a = getProperty( Name, LFHD );

The only time this calling convention may not be used is when options are being specified with the function call. The command below could not be written using the C function syntax because it specifies a command option -all.

select -all;

The three following examples are all equivalent statements.

snapToSytem LFHD 3.4 5.6 6.7;
snapToSystem( LFHD, 3.4, 5.6, 6.7 );
LFHD.snapToSystem( 3.4, 5.6, 6.7 );