07-17-2009 02:08 PM
07-20-2009
06:59 PM
- last edited on
10-25-2024
02:48 PM
by
Content Cleaner
Hi JulesG,
There is a DevZone Tutorial Calling Scripting Languages from NI TestStand. I also recommend the tutorial Introduction to Scripting in Perl, Python and Tcl. As for regular expression, the TestStand Help contains the following: NI TestStand Help - Regular Expressions
07-21-2009 08:35 AM
07-21-2009 04:53 PM
Hello JulesG,
Unfortunately the use of regular expressions in this case will not be possible. My first recommendation would be to store the standard output string in a String Property then pass that String to a code module (LabVIEW, CVI, .NET, whatever you're comfortable with) to parse it and return an Array of Strings.
If you absolutely must use TestStand's Functions, you may be able to accomplish your task by implementing the following pseudo-code:
Store Standard Output string in a String variable like Locals.myStandardOutput
Locals.startIndex = 0
Locals.endIndex = 0
Locals.arrayIndex = 0
While(Locals.startIndex != -1)
{
Locals.startIndex = Find(Locals.myStandardOutput, "hwTestLimit: ", Locals.endIndex, True, False)
If(Locals.startIndex == -1)
{
Break();}
Locals.startIndex = Locals.startIndex + 13 //This will make startIndex equal to the index of the first character of the string
//following "hwTestLimit: "
Locals.endIndex = Find(Locals.myStandardOutput, "\n", Locals.startIndex, True, False)
Locals.mySubString[Locals.arrayIndex] = Mid(Locals.myStandardOutput, Locals.startIndex, Locals.endIndex - Locals.startIndex)
Locals.arrayIndex++
07-22-2009 10:03 AM
03-07-2016 12:00 PM
I am trying to do the same thing. It would be nice (wish list) if Teststand could expose Regular Expression use in the built-in String functions without having to write something in external code modules...
03-07-2016 01:12 PM
You can post this idea in the Idea Exchange forum, which is monitored by NI's R&D!
http://forums.ni.com/t5/NI-TestStand-Idea-Exchange/idb-p/teststandideas
03-08-2016 08:19 AM
Though perhaps not as good as built-in, you can use the .NET adapter to call the .NET framework's regular expression libraries without having to write a code module.
Hope this helps,
-Doug
03-08-2016 01:50 PM - edited 03-08-2016 01:53 PM
That sounds good. What .NET assembly would I be looking for? Or what root class would I call? Can you provide a simple example?
03-08-2016 04:59 PM
I answered my own question. See the attached picture.