10-31-2007 01:27 PM
TS::StepPtr step = engine->NewStep(TS::NoneAdapterKeyName, TS::StepType_Statement);
// Assign its name to the step
_bstr_t calledName(stepName);
step->put_Name(calledName);
// Get all the sequence file variables into a PropertyObject
// TS::PropertyObject variables = TS::Execution.GetFileGlobals ( seqFile );
// Expression construction
_bstr_t expression("resourceHeader=ResStr(");
expression += _bstr_t(id_ptr) + ")";
step->CustomActionExpression.Assign(expression);
10-31-2007 01:43 PM
10-31-2007 02:39 PM
TS::SequenceFilePtr CreateSeqFileGlobals(TS::SequenceFilePtr seqFile) {
TS::PropertyObjectPtr propObjPtr = seqFile->AsPropertyObject();
propObjPtr->SetValString("Data.FileGlobalsDefaults.resourceHeader", 1 ,""); // resourceHeader
propObjPtr->SetValString("Data.FileGlobalsDefaults.resourceFail", 1, ""); // resourceFail
seqFile->IncChangeCount(); // Signify the file changed
return(seqFile);
}
Any idea why this doesn't do what I expect it to do?
Regards,
- Eric
10-31-2007 04:06 PM
11-01-2007 07:19 AM
Thanks. I will try this in a moment.
Is there any list of all the available "lookup strings"? I mean, I can't guess all the right strings and right spelling (do I) ?!?
- Eric
11-01-2007 09:49 AM
Most builtin TestStand settings do not need to be accessed via lookup strings. That is why I directed you to use the documented API property seqFile->FileGlobalsDefaultValues instead of a lookup string. By using the lookup string "Data.FileGlobalDefaults", you are taking advantage of undocumented knowledge of the implementation of the SequenceFile object. While this works and is unlikely to break in the future, theoretically we could change it since we don't document it.
This doesn't mean lookup strings aren't necessary. You need them whenever you use the API to access variables or custom properties of a type because these can be created by anyone at anytime and thus can't be hardcoded into the TestStand API.
Btw, I found the correct lookup string by breakpointing on a step, going to the variables view, and expanding Runstate.SequenceFile.Data to find the FileGlobalsDefaults property. I then right clicked and uses the context menu to copy the property path. Note that since you were starting from a SequenceFile instead of a SequenceContext (which is what the variables view displays), I removed the "Runstate.SequenceFile" part of the lookup string I copied.
11-01-2007 01:42 PM