NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Quering parameters of function calls using the TS ActiveX engine

I'm trying to query the parameters and types passed to the dll as given within TS. This is the code I'm having problems with:
Sequence.GetStep(i, StepGroup_Main).AsPropertyObject.TS.sdata("").call.parms(0).name
I just can't seem to get this call right. The return for this line should be the parameter passed, as text.
0 Kudos
Message 1 of 15
(4,346 Views)
Hi,
you don't say what programming language you're using to get the information with.
Attached is an example using a simple MessagePopup with the expression for the message set to :
RunState.Sequence.Main[Runstate.Loopindex].TS.SData.Call.Parms[0].Name
to get the details from the previous 4 DLL call steps (I used the show pass banner function in the modelsupport2.dll for convenience) which are set to skip so they're just place holders.
The MessagePopup is set to loop a set number of times (one less than the number of steps in the Main step group)

Hope this helps

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 2 of 15
(4,346 Views)
I'm attempting this in VisualBASIC (VBA). I am using the TS ActiveX engine to flatten out the information in such a way that TS cannot do. This line:

Sequence.GetStep(i, StepGroup_Main).AsPropertyObject.TS.SData.Call.Parms(0).name

results in "Unknown variable or property name." All of this results in no error:

Sequence.GetStep(i, StepGroup_Main).AsPropertyObject.TS.SData.Call

The errors start to creep in when I try to access methods or properties of .Call. Thoughts?
0 Kudos
Message 3 of 15
(4,346 Views)
Hi,
did you copy and paste that line above into the discussion group from VBA? round brackets won't work - need to be [].
You also say Visual Basic, but then say VBA, which is it, and if it's VBA, which application is it run from?

Try separating out the steps you're doing :
(Can't remember the layout for VB calls to the API, but I hope you get the idea)

stepHdl = Sequence.GetStep(i, StepGroup_Main)
stepHdlObj = AsPropertyObject(stepHdl)
GetValString (stepHdlObj,"TS.SData.Call.Parms[0].name")

Hope that helps

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 15
(4,346 Views)
Its VBA in Excel. As I believe, () (dimensions/arrays) is used for all BASIC (& variants) and [] is used by C/C++ (& variants). The following in VBA:

Sequence.GetStep(i, StepGroup_Main).AsPropertyObject.TS.SData.Call.parms [0].name

yeilds "Object Required". The intial set of () (.GetStemp(i, StepGroup_Main)) is needed as they setup the arguments to be passed to this method. Let me break out the steps and report back.
0 Kudos
Message 5 of 15
(4,346 Views)
If I break it out to:

Dim sTemp3 As String
sTemp3 = ""
Dim step As TS.step
Dim object As TS.PropertyObject
Set step = Sequence.GetStep(i, StepGroup_Main)
Set object = step.AsPropertyObject
temp3 = object.TS.SData.Call.parms(0).name

It works for i from 0 to 25. So now atleast I know its working, sortof. It no longer results in an error, but now as an empty string. I still need to read the argument count, the argument names, and the argument types.
0 Kudos
Message 6 of 15
(4,346 Views)
So,

object.TS.SData.Call.Func results in the function actually called.

object.TS.SData.Call.parms(u).name resutls in ""

object.TS.SData.Call.parms(u).Type results in 0.

And its consistant, and no errors, til I get to the 25th step which is not a function call.
0 Kudos
Message 7 of 15
(4,346 Views)
Hi,
can you post your sequence, and the excel workbook the VBA stuff is in so I can have a play?

The Func I take it is coming back correctly?
but the call into the array of parms is coming back with defaults as if it can't get into them?

Thanks

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 8 of 15
(4,346 Views)
Hi,
erm....

Dim sTemp3 As String
sTemp3 = ""
Dim step As TS.step
Dim object As TS.PropertyObject
Set step = Sequence.GetStep(i, StepGroup_Main)
Set object = step.AsPropertyObject
temp3 = object.TS.SData.Call.parms(0).name

The variables in bold - are they supposed to be the same?

here's another thought, how about something like :

Dim sTemp3 As String
sTemp3 = ""
Dim step As TS.step
Dim object As TS.PropertyObject
Set step = Sequence.GetStep(i, StepGroup_Main)
Set object = step.TS.SData.Call.parms(0).AsPropertyObject
sTemp3 = object.GetValString("name")

so instead of accessing the value as part of the object itself, you're getting the TS API to query the object and return the value.

Mig
ht not work, but it's another thought.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 9 of 15
(4,346 Views)
Amazing, the GetValString("name", 0) method actually worked!

Thank you 🙂

Now, all that I need to do is figure out how to access "%LO: Parms" in "
[SF.Seq[0].Main[17].TS.SData.Call]" and I'm pretty much set.

And, yes, I caught the sTemp3/Temp3 error after I posted it, but regardless, it still didn't work.
0 Kudos
Message 10 of 15
(4,346 Views)