beautypg.com

8 ivscriptengine::setscriptvar, Parameters, Return values – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual

Page 131: Remarks, Example, Ipetrace* pe_trace, Ipeverificationscript* pe_vscript = null, Ivscriptengine::setscriptvar

background image

Teledyne LeCroy

Automation API for PETracer/PETrainer

126

9.1.8 IVScriptEngine::SetScriptVar

HRESULT SetScriptVar ( [in] BSTR var_name, [in] VARIANT var_value )

This method allows you to set the value of some verification script global variable before/after executing the
script (refer to the PETracer Verification Script Engine Manual and the File Based Decoding Manual for
information on how a script can declare, set, and use global variables). Only integers, strings, or arrays of
VARIANTs are allowed as correct values. Arrays of VARIANTs is converted into list values inside of scripts. See
the PETracer File Based Decoding Manual for more details about list objects.

Parameters

var_name

String providing the name of the global variable used in the verification

script being run

var_value

VARIANT value containing the new variable value

Return values

E_PENDING

If this method is called when the script is already running

Remarks

This function may be very useful because it allows you to set internal script variables before running a

script, giving you the opportunity to make run-time customization from COM/Automation client applications.

In order for this operation to take effect during execution of the script, a global variable with the name

specified by var_name should be declared by the script.

Example

C++:
// In this example we use wrapper functions provided by #import directive
//

IPETrace* pe_trace;


. . .


IPEVerificationScript* pe_vscript = NULL;

pe_trace->QueryInterface( IID_IPEVerificationScript, (void**)&pe_vscript ) )

assert( pe_vscript != NULL );

IVScriptEngine* pe_vsengine = NULL;
pe_vsengine = pe_vscript -> GetVScriptEngine("Test_1");
assert( pe_vsengine != NULL );

VARIANT my_var;
VariantInit( &my_var );

my_var.vt = VT_I4; // Integer
my_var.lVal = 100;

// set internal script variable 'MyVar' to 100
pe_vsengine->SetScriptVar( _bstr_t("MyVar"), my_var );

VS_RESULT result = pe_vsengine ->

RunVScript

();

. . .