09-18-2023 08:27 PM
Hi ALL
I need to use text script to edit my test program and send it to LabVIEW to execute,but i do not konw how.Below is my thinkings,
---------------------------------------------Script Start-----------------------------------------------------
09-18-2023 08:36 PM
Before you can write a script to help you create LabVIEW code, you need to know how to write LabVIEW code! That is, you should probably spend a year or two writing LabVIEW programs (and really understand LabVIEW as a programming language) before you can use LabVIEW scripting to write LabVIEW programs.
How confident are you that you can write LabVIEW code to handle the very simple program you showed? If you can't write the LabVIEW code, how do you expect to write a program to write the LabVIEW code for you? What are you trying to accomplish?
Bob Schor
09-18-2023 08:47 PM
Hi Bob
How confident are you that you can write LabVIEW code to handle the very simple program you showed?
I can write LabVIEW code to handle my simple demo.
What are you trying to accomplish?
Editing and executing test sequences using text formatted scripts.
09-18-2023 10:00 PM
Seems like a terrible idea. Why on Earth would you want to do that?
Essentially you're wanting to write an app that translates your script pseudo code into LabVIEW code.
Unless your scripts are guaranteed to be primitive, writing the translator will be a very large undertaking.
09-19-2023 12:43 AM - edited 09-19-2023 12:44 AM
Hi Paul,
@paul_a_cardinale wrote:
Seems like a terrible idea. Why on Earth would you want to do that?
I did that once (20 years ago) too: my goal was to make a testbench "sequencer" more configurable. The old version handle a fixed sequence of steps and I wanted a user-definable sequence of steps.
I made a simple translator to convert the old-style config files into a batch file producing the same sequence as before, but now I ("the user") was able to define my own test sequences with much more degree of freedom. In the end I implemented a simple interpreter with conditions and (nested) loops…
09-19-2023 03:34 AM
OK, so basically, you want a LV program to read in a file and execute the commands within it one by one, passing parameters to pre-defined functions within the code?
This sounds pretty much like a queued message handler, but with the inputs coming from file. This can be quite useful
Note that some replies here are assuming your use of the word "script" means you want to use "LabVIEW scripting" which allows you to use LabVIEW to actually program LabVIEW, something I would strongly advise against for this kind of purpose. Bear that in mind when mentioning "script" in a LabVIEW context. It might be better to refer to your "script" as an ASCII file instead.
09-19-2023 03:54 AM
yes,user use the EDITOR to edit a text seq,generated the seq file,such as 'seq.m'.
09-19-2023 04:28 AM
You keep referring to "the EDITOR".....
Which editor do you mean, do you have a specific editor in mind or do you mean just any old text editor?
09-19-2023 10:56 AM - edited 09-19-2023 10:57 AM
@Yuanxj wrote:
SpoilerOK, so basically, you want a LV program to read in a file and execute the commands within it one by one, passing parameters to pre-defined functions within the code?yes,user use the EDITOR to edit a text seq,generated the seq file,such as 'seq.m'.
OK. I've done a couple of versions of that. In the simple version, the test sequence was a .ini file. The sections served only to clarify the structure of the test sequence (presented as a tree control); except that the test executive would jump to the last section (which had to be [Cleanup]) on abort.
Each line specified the (relative) path to a VI and parameters; like this: folder_path\my_test.VI; channel = A1, voltage = 2, insanity_level = 1000
The VIs all had to have the same connector pane, receiving 2 string arrays, one having the parameter names, the other having parameter values.
Note: To prevent your test executive from aborting if a test module aborts, use the "Call By Reference" to call the test modules.
09-19-2023 12:19 PM
you will need to implementa command interpretor in labview,
for each line, each code will make labview execute previously implemented code.