8 ivscriptengine::setscriptvar – Teledyne LeCroy SAS_SATA Tracer_Trainer Automation API Manual User Manual
Page 80
![background image](/manuals/353616/80/background.png)
LeCroy Corporation
Automation API for SAS/SATATracer/Trainer
Manual Version 1.11
80
8.1.8 IVScriptEngine::SetScriptVar
HRESULT SetScriptVar (
[in] BSTR var_name,
[in] VARIANT var_value )
Allows you to set the value of some verification script global variable before/after executing
the script (refer to the SASTracer 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 are converted into list values inside of scripts. See the SASTracer File Based
Decoding Manual for more details about list objects.
Parameters
var_name
String providing the name of the global variable used in the
running
verification
script
var_value
VARIANT variable containing the new variable value
Return values
E_PENDING – if this method is called when the script is already running
Remarks
This function 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 the #import directive.
ISASTrace* sas_trace;
. . .
ISASVerificationScript* sas_vscript = NULL;
sas_trace->QueryInterface( IID_ISASVerificationScript, (void**)&sas_vscript ) )
assert( sas_vscript != NULL );
IVScriptEngine* sas_vsengine = NULL;
sas_vsengine = sas_vscript -> GetVScriptEngine("Test_1");
assert( sas_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.
sas_vsengine->SetScriptVar( _bstr_t("MyVar"), my_var );
VS_RESULT result = sas_vsengine ->
RunVScript
();
. . .