07-26-2016 05:25 AM
Does anyone know if it is possible to specify macros in expressions or is this something I should add to the ideas exchange?
Let's say I'm building a fairly long compound expression that has some repeated parameters - is there a way to specify (without creating additional locals) a variable/macro for use just within that expression?
For example, instead of:
Locals.CommandLine = "cmd /c C:\some path\that\is\reused"
Locals.CommandLine += " /path C:\some path\that\is\reused"
I could specify:
#pathmacro C:\some path\that\is\reused
Locals.CommandLine = "cmd /c " + pathmacro
Locals.CommandLine += " /path " + pathmacro
This is a simple example, but hopefully you can see why this would be useful and why I wouldn't want to create lots of locals when the values are required only within the expression.
07-26-2016 06:30 AM
There are no macros in the way you request them in TestStand... at least i am not aware of.
However, you can use FileGlobal variables (or other, more suitable access scopes) which use the "Not Editable" flag. Just configure the variable and finalize it with selecting Advanced >> Edit Flags in the context menu. Not Editable should be the first in the list.
Norbert
07-26-2016 09:10 AM - edited 07-26-2016 09:10 AM
@Norbert_B wrote:However, you can use FileGlobal variables (or other, more suitable access scopes) which use the "Not Editable" flag. Just configure the variable and finalize it with selecting Advanced >> Edit Flags in the context menu. Not Editable should be the first in the list.
Yes, I was aware of using variables in the expressions but the variables I am using here are specific to the particular expression I am editing.
I've posted it over on the ideas exchange here: http://forums.ni.com/t5/NI-TestStand-Idea-Exchange/TestStand-Expression-Macros/idi-p/3326972
07-26-2016 09:15 AM
I would call that an "Expression Local (variable)"..... 😉
Norbert