NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract button name after message popup step completed?

Hello!

I wonder is it possible to get the pressed button name from "message popup"? It is easy to get button index, but I don't find a way to get buttons array. Is it possible to get buttonNlabel substituting N from button hit?

Thank you in advance!
0 Kudos
Message 1 of 6
(4,307 Views)

Sure, just build an expression to do it. For example from the following step you could use:

Evaluate(Evaluate("RunState.PreviousStep.Button" + str(RunState.PreviousStep.Result.ButtonHit) + "Label"))

The inner Evaluate returns the expression for the button label, which is usually a string constant. The outer Evaluate evaluates that expression, which in the case of a string constant just removes the quotes.

Message 2 of 6
(4,300 Views)
Exactly what I asked for Smiley Happy
Thank you very much!
0 Kudos
Message 3 of 6
(4,274 Views)

This expression causes TestStand to crash if the close button on the popup is clicked

0 Kudos
Message 4 of 6
(3,142 Views)

Hi Sumit,

 

Can you clarify more of what you are doing in TestStand and what the close button is doing on the popup? 

I was not able to recreate what you are seeing. The expression evaluated fine for me in TestStand 2017. 

0 Kudos
Message 5 of 6
(3,117 Views)

Hi Roxana,

 

I am trying to log the text of the button that was clicked by the user. The button number does not help when I want to know why the user selected that option. Within the pop-up message step, I use the following to evaluate the button text in "Additional Results": 

#NoValidation, Evaluate(Evaluate("Step.Button"+Str(Step.Result.ButtonHit)+"Label"))

This evaluation will give an error if the close button on the pop-up window is clicked.

 

However, I have found the mistake I was making. In the "Button Options" section I select a button for "Cancel Button". If I select "None" here then the close option in the pop-up window is disabled and the user has to select one of the provided buttons.

 

Thanks

Sumit

0 Kudos
Message 6 of 6
(3,027 Views)