LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec.vi --> strange behavior?

Folks, I am getting the heebee - jeebees with this one.

I have a simple program, test.vi, that uses the system exec.vi command to run a program from the command prompt. Intermittently, I am getting an error 2 "System Exec.vi. Command was "SIC.EXE -T C:\Horiz.rf" "Error 2 occurred at System Exec.vi. Command was "SIC.EXE -T C:\Horiz.rf"

Possible reason(s):

LabVIEW:  Memory is full."

JUST RUN THE TRUE CASE ["Use Copy"] WHICH IS THE DEFAULT CASE, at least at first.  (The False case, which is the really simple case seems to work fine (until you have messed up the DOS command prompt situation by running the True case; you can try this too if you like.)

To exactly duplicate for running the TRUE case, you will have to create the directory: "C:\Program Files\National Instruments\ROTH LABVIEW\SONIX CSCAN\Ceramic Wedge" and place Horiz.RF file in this directory.  (For running the FALSE CASE, place Horiz.RF file in c:)

Also, first place the program sic.exe in c:.  This code takes an ".rf" file and creates .NDF and .NEU files from it.  If you run it from a DOS window, it works every time using the syntax: SIC.EXE -T c:\Horiz.rf

Any idea why I might be getting the error?  Needed another set of eyes on this one.

Thanks,

Don
0 Kudos
Message 1 of 14
(4,397 Views)
Hello Don,

Have you tried using "cmd /c SIC.EXE -T Horiz.RF" instead for the command line? For more information on this please refer to the following knowledge base document: Error 2 (Memory Full) When Using the System Exec VI.

I did not get error 2 trying your VI with this command, but let me know if this doesn't solve the problem.

Good luck and best regards,
Shakhina P.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 14
(4,368 Views)
Hi:
 
I get the same error with your revised command line.  I had seen that solution when researching the error.
 
Are you telling me that with the VI I sent you as is, you did not get the error 2 message?  Or are you saying after you used the substitute command line with the new syntax, you did not get the error 2?  I would be interested to know this.  Neither way works for me when I use the case with the 'COPY' command.
 
Sincerely,
 
Don
0 Kudos
Message 3 of 14
(4,351 Views)
Hello Don,

Sorry for a late reply. When I run your VI as is, I get Error 2 in both cases. But when I change the command to "cmd /c SIC.EXE -T Horiz.RF", both cases execute correctly. I have tried executing the True case multiple times and it worked as expected each time (just removed Horiz.rf, Horiz.ndf and Horiz.neu from C:\ each time, since otherwise Copy function returns <Not A Path> ).

I am using LabVIEW 7.1 on Windows XP SP2. Which version of LabVIEW and which OS are you using?

Good luck and best regards,
Shakhina P.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 14
(4,310 Views)
Have you tried "C:\SIC.EXE -T ..." instead of "SIC.EXE -T ..." when you built the command string? Seems to work fine after that.

Message Edited by altenbach on 10-10-2005 04:27 PM

Message 5 of 14
(4,309 Views)

EUREKA!!

 

Just adding the C:\ in front of Sic.exe was the solution (for a total of "C:\SIC.EXE -T")

 

Thanks much for this one, it was driving me up a wall.

 

Sincerely,

 

Don

0 Kudos
Message 6 of 14
(4,284 Views)

😄

Also, don't forget some error handling, etc. e.g.:

  1. Skip the rest of the code if the file dialog is cancelled.
  2. Handle the situation if "copy" causes an error.
  3. Test if sic.exe exists.
  4. Test if output files already exist (your code seems to stall if this happens).
  5. etc.

I also think it is poor practice to operate in the root of the C drive for things like that. Files related to this program should be encapsulated in their own subfolder.

0 Kudos
Message 7 of 14
(4,278 Views)
Good points.
 
In my real code, I have started to address some of this.
 
In the test code I sent, I put in the bare bones for testing.
 
I wish there were overwrite options in the Copy and Move fxs.  I wonder if there are any other functions that address these limitations.
 
Sincerely,
 
Don
0 Kudos
Message 8 of 14
(4,258 Views)
ps.  I only moved to the root because I seemed to be having problems executing in the subfolder!!!  For example, see the attached. In this case, I don't get an error from the system exec.vi, yet it does not perform the SIC.EXE function as it should (i.e. convert .RF to .NDF and .NEU files).  In this example, SIC.EXE actually resides where I want it to and is the parent of the working directory 'TEST'  .....Don
0 Kudos
Message 9 of 14
(4,254 Views)
Have you tried removing the extra space between the "-" and the "T" in the path constant?
 
(Still, I would hesitate to place the "-T" part into a path constant as you do here. While it seems to work OK, it feels wrong, because it is not a path but a composite between a path to the program and a commandline option. I would add -T later using concatenate string. Unlike strings, path constants are special, because they are OS independent. If you would open your program on a Mac, the text in the path constant would look quite different.)
0 Kudos
Message 10 of 14
(4,182 Views)