NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get execution object for ActiveX/COM method Step.GetRunModeEx?

I would like to know how to get the execution object to pass into the ActiveX/COM method Step.GetRunModeEx.
0 Kudos
Message 1 of 8
(4,068 Views)
Hi Snood1,

You can get a reference to the object with SequenceContext.Execution. I also wanted to note that the parameter for that function is optional.

Cheers!
Test Engineer - CTA
0 Kudos
Message 2 of 8
(4,043 Views)
The parameter isn't optional for me because I need to get the runtime mode of a step, which may differ from the static mode.

I see that you can call "Get SequenceContext.Execution," but this returns a value of type 'object reference.'  Step.GetRunModeEx requires its execution object input parameter to be of type variant.  How can I convert 'object reference' to 'variant?'
0 Kudos
Message 3 of 8
(4,040 Views)
Snood1,

I should have clarified more, my apologies. Since you are using an ActiveX/COM module, you should pass the sequence context into your code module and then use the PropertyGetValVariant function and use the lookup string "RunState.Execution". This returns a Variant data type which you can then pass into GetRunModeEx. For code samples in CVI see here.
Test Engineer - CTA
0 Kudos
Message 4 of 8
(4,031 Views)
I don't want to use CVI for this application.  I'm using the ActiveX/COM adapter in TestStand.  Specifically, I'm using the Step.GetRunModEx method, which has a variant input for the execution object.  What's troubling, though, is that I can't declare a variable of type variant.  The only choices I have are number, boolean, string, and object reference.  So how I am supposed to get something of type variant to pass in here?
0 Kudos
Message 5 of 8
(4,024 Views)

Hey Snood1,

Here's an example that demonstrates what you may be looking for.

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 8
(4,018 Views)
Thanks for the example.  It worked.  Is it documented somewhere that you pass "RunState.Execution" as your variant into Step.GetRunModEx?  I don't recall seeing it anywhere, else I wouldn't have needed to ask for help.
0 Kudos
Message 7 of 8
(4,004 Views)

Hey Snood1,

There are other posts about this out there but as far as information in the released documentation it is kinda vague as to the fact that you can simply put any data type there.  The definition states "Data type that can hold any defined type of data"  But I can see the confusion that you don't have to actually convert it to a variant first.  Generally you do have to convert it first.  However some TestStand functions will allow any datatype and convert it for you. 

Jon is going to create a Knowledge Base regarding this information and hopefully alleviate some of the pain for others in the future.

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 8 of 8
(3,991 Views)