LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a Step in TestStand automatically

Hello,

i'm searching a code example of a procedure, that generates an arbitrary step in TestStand using LabWindows/CVI and the TestStand API.

My way to solve the problem doesn't work, maybe you can help me.

My Code:
TS_EngineNewStep (engine, &errorInfo,"", TS_StepType_Statement,&newStep);

TS_StepSetProperty (newStep, &errorInfo, TS_StepName, CAVT_CSTRING, "My First Step");

TS_SequenceInsertStep (newSequence,&errorInfo,newStep, 0,TS_StepGroup_Main);
0 Kudos
Message 1 of 5
(3,102 Views)
Hi,
you're on the right lines.
Attached is an example in TS 2.0.1f1 and CVI 6.0.

I think the problem you're having is you're changeing the name of a step which doesn't exist as yet. It's an object, so change the Name static property instead.

I've added in the code to check for duplicate step names, and all the handle getting stuff.

Hope this helps.
S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 2 of 5
(3,102 Views)
Hi,
forgot to say - if you create an executable that does this, or even a .dll that you call from a sequence, you MUST have a developers license on the machine you're running it on. It's a tiny note but worth adhering to -

From http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/57e2589b6f5cccdd86256726001e450f?OpenDocument

Please Note: This example requires a TestStand Development System License on each machine it is used. The TestStand license specifies that any application that uses the TestStand engine to do sequence editing requires the Development System License; applications that use the TestStand engine to do tasks other than editing sequences (opening, running, debugging) require a TestStand Run-Time License For mor
e information consult License.doc in the TestStand/Doc directory or contact National Instruments.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 3 of 5
(3,102 Views)
Thank you for your help, but the problem is not solved. I think the problem is in that line of code:

// make the new step
tsErrChk(TS_EngineNewStep (EngineHdl, &errorInfo, "", "Statement", &NewStep));

If I write this line of code in my source code, the application say it can't find the label "Statement". But I have included "tsapicvi.h". Without this line the application does what I want - but without this line i can not create any new steps.

What does go wrong?
0 Kudos
Message 4 of 5
(3,102 Views)
Hi,
can you check that you still have a Statement step in your copy of TestStand - The application is looking for a match for "Statement" in the typeuseage list. - Go to the type palette in TestStand, and select NI_Types.ini. Check that Statement is one of the valid types.

Otherwise, try replacing "Statement" with any of the following :
StepType_Action - (Value: "Action")
StepType_CallExecutable - (Value: "CallExecutable")
StepType_Goto - (Value: "Goto")
StepType_Label - (Value: "Label")
StepType_LimitLoader - (Value: "LimitLoaderStep")
StepType_MessagePopup - (Value: "MessagePopup")
StepType_MultiNumericMeasurement - Value: "NI_MultipleNumericLimitTest")
StepType_NumericMeasurement - (Value: "NumericLimitTest")
StepType_PassFailTest - (
Value: "PassFailTest")
StepType_SequenceCall - (Value: "SequenceCall")
StepType_Statement - (Value: "Statement")
StepType_StringMeasurement - (Value: "StringValueTest")

If none of these work, then I'd suggest calling your local Ni tech support.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 5 of 5
(3,102 Views)