System exec function
could someone give me a hint as to what the 'expected output size'
input on System Exec refers to? I'm using it to run another program
which will download some data for me to work on with labview. I dont
expect it has anything to do with the file size of that data?
Also, is there a way I can tell when the program I have called has run
to completion? Or can i just use the 'run to completion' boolean to
prevent the next part of the VI executing before the data has finished
downloading?
Thanks, Paul.S
"mechatron" wrote in message
news:[email protected]..
> could someone give me a hint as to what the 'expected output size'
> input on System Exec refers to? I'm using it to run another program
> which will download some data for me to work on with labview. I dont
> expect it has anything to do with the file size of that data?
A called program might pass some information, but when the application
terminates, the memory with this information is released. So, the program
passes a pointer to a string, but the memory it points to is removed.
To prevent this, the caller passes a pointer to a buffer, and the program
fills this buffer. Then it passes the same pointer back, and the caller can
read the message in it's
own memory. This buffer needs to be large enough.
If the program don't pass anything (you don't expect anything), just put the
"expected output size" on the default value. A buffer that is to big can't
do any harm.
> Also, is there a way I can tell when the program I have called has run
> to completion? Or can i just use the 'run to completion' boolean to
> prevent the next part of the VI executing before the data has finished
> downloading?
Yes, that's what is it for.
> Thanks, Paul.S
Similar Messages
-
Open a *.exe applicatio​n in LABVIEW with system exec function.
Greetings,
I would like to be able to lauch a *.exe application and open a specific file within my labview vi. The trick is to avoid using active X control at all cost. I would like to use the system exec function but I couldn't quite get it to work.
Let's assume that I would like to lauch wordpad.exe from my local drive. What are the params I need to pass? Thanks.You have to type in the command line of the System exec vi the name of the executable and eventually its path.
Look at the attached vi that launches Wordpad as you asked.
Attachments:
wordpad_exec.vi 72 KB -
System Exec use all resources system if "wait until completion" is true !
Hello,
I use the function "System Exe" since a long time to launch various executables since Labview.
The " waint until completion " boolean is true, because I have to wait the end of the external executable to continue.
Big problem: the function " System Exec " use all resources system, by waiting for the end of the external program.
Is it a bug of this function ?
In my example, "System Exec" launches only the notepad (LV 8.2 on XP)
Thank you for your suggestions.
AC
AC
Attachments:
Process.jpg 86 KB
Bug system exec.vi 17 KBThanks to both for your speed.
In fact I had simplified my vi to target the problem.
I use System Exec to launch another executable, made possibly with labview, but with passage of parameter. (Ex: - " / string:init ").
In the literature Labview it was made with the method cmd / x / c start by putting twice the path of the executable.
In this method a waiting time in the recent system exec function was effectively missing.
But effectively, today, it is enough: "c:\myexe.exe" - " / string.init " to launch and to pass a parameter.
You have both reason and I thank you sincérement.
Very cordially.
Sorry for my English....
AC
AC -
Close a notepad window in labview after opening it with system exec
Is there a way to close a notepad window within Labview after opening the window using the System Exec function?
Also can Labview send characters to Notepad so they show up in its window?You can send a quit message to another window by using one of the VIs in a collection of windows interaction VIs called winutil32 (or something similar), but you will have to know the window name. Try searching for it on this site.
You could probably also use the windows PostMessage function to send characters to another window, but that would require learning how to work with DLLs in LV, reading up on the function at the MSDN site and implementing it. Another, more simple but less secure, way is to use the windows Keybd_Event function to simulate keyboard clicks. If the notepad window has the focus, it will receive those clicks. Try searching this site or google for things like "Keybd_Event LabVIEW" or "simulate keyboard".
Try to take over the world! -
System exec with telnet.exe
I am trying to execute the windows program telnet.exe from the system exec function but I only get error 2 back. I am aware that it indicates that the path of the program is not correct. However when I do the same with notepad.exe which is in the same folder (c:\windows\system32\) it works fine.
Any ideas?
/martin
Attachments:
telnet.vi 14 KBRollerboy wrote:
Hi again Mark
I was looking among the examples but I don't seem to find what you are refering to. Could you please direct me!
You could search for TCP using the example finder. They have basic examples of servers and clients. Do you have all of your palletes visble? You can view more by selecting additional palletes. View the Functions pallete (View->Functions Pallete) and select the Customize tab. From there make sure you are displaying the Data Communication pallete.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot -
System Exec and Call Library Function problems
I have working c code. The code connects to a server; makes a request; and gets a return. It works from the command line. In LV there are problems. If I try running it using the System Exec vi, I get the response I expect but not until the connection with the server is broken. This is unacceptible and not the way it works from the command line.
If I try to use the Call Library Function Node, the response is even stranger. I just call the routine that is supposed to connect to the server. It fails.
I attached the vi's. As you will see, they are very simple.
Attachments:
AO call.vi 9 KB
AO connect.vi 9 KBexo,
Here is the example Mike was referring to. Let me know if it helps at all.
Brian T
Applications Engineer
Attachments:
Calling System Exec.vi 31 KB -
Access system exec standard out before function returns
Hello,
It would be enormously helpful to me if I were able to parse the output from the system exec vi before the invoked command fully returns. Is it possible to do this?
ThanksJust about any question you can think of has probably already been asked before. So doing a search will get you the results without relying on someone repeating themselves 100 times.
Unfortunately, the search engine on the forums is not that great. If you search for a pluralized word, the singular form of the word doesn't show up. And of course there can be misspellings which can keep you from find useful information.
Also, if you used your exact title as your search phrase, then you probably used too many words. Sometimes adding too much to the search restricts it to the point that you can't find anything. So the best strategy is to start with just a couple, then if you find the search yields too many results, then narrowing that with another word or two based on some of the words you just saw in the results.
Also, sometimes it is better to go to Google and search for your subject. The discussion forums are all indexed by Google, and it does a much better job catalogging the search terms then the forum's search engine does.
Please forgive us if we say "do a search!" It just seems that so many times, people come on, ask a question where we know the answers exist and that if they just did a good search for 5-10 minutes they can find them, but a lot of people just go the lazy route, don't bother to search, and ask the question. -
How to capture keyboard strokes while focus is on an external app. Opened with system exec
Hi to the Forum,
I have an application that runs an external app. Through system exec, while this application is open the user needs to input a 6 digit serial number using the keyboard, I need to capture in parallel that information on my main VI in order to perform some information validations, such as the six digits were entered, the serial number is not repeated etc. I have read other post about the same issue but did not found a practical way to achieve a solution, please help with an example of how to do that as I'm on the final stage of the project.
Thanks in advance for your time and help.
MRDKHi MRDK,
You can/have to use Connectivity>>Input Device Control palette functions.
Attached is the simple example.
Regards,
Yogesh Redemptor
Regards,
Yogesh Redemptor
Attachments:
Get Keyboard Event.vi 15 KB -
I have a java daemon process A. Process A uses the Runtime.getRuntime.exec() function to run other java process(es) B at fixed intervals. Both A and B do not display any windows, frames, dialogs , messages etc...
Process A is started via commandline in ...../FolderA:
java - cp .:classesA.jar processA
In Process A, I use the exec function to launch Process B, in ..../FolderB as follows:
String command = java - cp .:classesB.jar processB
String workingDir = ...../FolderB
String envArray[] = null;
prcs = Runtime.getRuntime().exec(command,envArray,workingDir);
On Windows:
1) I can start Process A via commandline on windows, and it runs Process B correctly
2) I telnet to the windows system from linux, and start Process A. It still runs Process B correctly.
On Linux:
1) I start Process A via commandline from RedHat desktop terminal, and it runs Process B correctly, but I get the following message:
Warning: Cannot convert string "<Key>Escape,_Key_Cancel" to type VirtualBinding
Warning: Cannot convert string "<Key>Home,_Key_Begin" to type VirtualBinding..... + 4 more similar warnings
Even with these warnings, process B runs fine and returns with exit code = 0,
2) However, If I telnet to Linux from windows, and start Process B, then Process B fails and returns with exit code = 1. Also, no warning or error information is available from the runtime.exec function.
It seems like an 'environment' issue related to X11 or some shell setting needs to be put into envArray[]. I am not a Unix person and have no idea about fixing something like this. Any inputs would be appreciated.In the GUI environment (whether you really use it or the JVM just thinks it is needed) the DISPLAY variable has to point to the X server. If you leave it out from the enviroment when exec'ing the second JVM from the first one, then it will become a problem.
-
thanks
One suggestion is to write a batch (.bat) file that will call your executable. The batch file can contain all the standard inputs necessary to run the executable. Then, in LabVIEW, you can call the .bat file using the System Exec.vi.
As far as your second question, there is no slick way to do this LabVIEW. You would probably have to call Window API functions using the Call Library Function utility. There is a set of VI's that call some of the standard API functions but I don't think they have what you want.
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&74DDE683A1AFF6988625683A000C0D73&cat=034E59A8530E09DF862568900018707A
Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect -
General Inquiry Regarding Error Handling with System Exec.vi
I have a sub vi that uses the System Exec.vi to send SMS messages when triggered. I am confused as to how the error handling works and why all of the errors seem to go to the "standard error" vs the "Error out". The reason I am interested is because I am trying to interrupt the error out of another script to execute a command if error=true.
I have intentionally created an error to test this, however it does not seem that the signal is ever being sent to the error out, only to the standard error.
Any help/explanation as to how this works would be greatly appreciated.The Facebook discussion board is just a pilot and that functionality is not available yet (as to my knowledge). You will have to use the actual forum thread to add attachments. You can click the arrow just to the right of thread topic in the Facebook thread and that will take you to the ni.com/forums thread. Or you can navigate here:
http://forums.ni.com/t5/LabVIEW/General-Inquiry-Regarding-Error-Handling-with-System-Exec-vi/m-p/246...
Having a look at your VI would help to clarify the error handling issue.
Daniel K | NI Applications Engineer | Certified LabVIEW Developer -
I'm trying to run a MSDOS based program in labview. Will I have to move to a certain directory where the executable is located? For example, to open labview.exe. I created a sequence which first inputs "cd\labview\" into system exec and then in another sequence frame have another system exec file with "labview.exe". But both system exec give me an error 42 when I try to use it in my application.
In addition, after I open my executable, I want it to stay open until the user goes to file and quit within the program. There is no "wait until completion" option in lv 5.0. Any other suggestions?
If you do have suggestions, some source code would be nice to see so I can follow along with what you are saying.
Thanks a lot.Ok, I actually got that working. I found the system exec+ file and that has the wait function on it. Whats happening now is that when its reading in my program (awc.exe), it pops up an error message (in dos) that says "cannot find fonts." The font files are in the directory (c:\awc) with the executable. Do I need to link the font files somehow to awc.exe, or is this being caused by some other problem?
-
Problem: Using "msg" command with "System Exec.vi"
I'm attempting to write some LabView code that takes advantage of the "System Exec.vi". At the moment, I've tried using it to ping machines, return the ipconfig and run through the example code that NI provides.
I would like to use the "msg" command used on Windows operating systems to send out a message to multiple machines on our network at once. Warning them we're about to update a program and they should log-off, things like that.
I tried using the "msg" command in LabView keeps returning errors. I also wrote a quick batch file as follows:
@echo on
cd c:\Windows\System32\
msg.exe /server:localhost * test
When I launch the batch from windows, it executes. When I launch it from LabView (using the System Exec.vi) it fails.
Potential Quirks:
I discovered in a different location that in order for a machine to receive these messages they need to have a registry entry in:
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" and have a DWord called "AllowRemoteRPC" = 1.
Note that "/server:localhost" could be "/server:anycomputer" and the " * " is used as a wildcard which sends a message to anyone who is logged onto that machine. Also note that "test" is the message to be sent.
Any ideas why I'm having a problem?
tl;dr: "System Exec.vi" won't run the "msg" command. Why is this?
- Mike
~~~~~~~~~~~~~~
Current Setup:
LabView 2010
Windows 7
Solved!
Go to Solution.-> What versions of labview and windows are you on?
LabView 2010 and Windows 7.
-> Have you ever sent any commands out, or is msg the only one you've tried so far?
I've successfully used the 'ping' command and also returned a standard 'help' command to LabView.
-> Finally, in tools>>options, you may need to change your access settings under VIserver and Webserver.
My VI server settings are allowing everything except "Show VI Scripting Functions, properties and methods"
I have nothing configured for a web server, since I didn't plan on using it for this. Unless it has some sort of connection that I am missing.
I'm attempting a work-around where LabView will generate a batch file to run from the desktop instead, since it seems that something is getting lost in translation between LabView and the command-prompt.
- Mike
~~~~~~~~~~~~~~
Current Setup:
LabView 2010
Windows 7 -
How does System Exec VI identify Standard Error within cmd code?
I am using the System Exec VI to control a USB to serial adaptor program header, I have sucessfully written a .BAT file to call the CMD commands (the .exe I am running uses "-option" commands and the help file reccomends to do so) and it functions perfectly. My only issue is identifing errors. The "Standard Error Out" on the System Exec VI never outputs anything. Yes the wait until completion is TRUE and my standard output functions fine. I am curious as to how the System Exec VI identifies errors from the command prompt and why my errors are not showing up. I am currently using multiple match pattern string functions to identify the possible errors from my standar output for the time being but I would like to simplfy my code a bit and clean it up if at all possible. Not to mention there are most likely several other errors that could occur that I may have not identified. Some examples of stanadrd output errors i can get include include:
{C:\Documents and Settings\owner\Desktop\RACK LINK>C:\DCRABBIT_10.66\Utilities\clRFU.exe "" -s "0":115200 -v -vp+ -usb+
.bin not found
C:\Documents and Settings\owner\Desktop\RACK LINK>pause
Press any key to continue . . . }
or
{C:\Documents and Settings\owner\Desktop\RACK LINK>C:\DCRABBIT_10.66\Utilities\clRFU.exe "C:\Documents and Settings\owner\Desktop\RACK LINK\Calibration_v030.bin" -s "4":115200 -v -vp+ -usb+
Rabbit Field Utility v4.62
Installing Calibration v0.3.0
Sending Coldloader
Error: No Rabbit Processor Detected.
C:\Documents and Settings\owner\Desktop\RACK LINK>pause
Press any key to continue . . . }I think you should use error handling in batch programming, see this link http://www.robvanderwoude.com/errorlevel.php
CLA 2014
CCVID 2014 -
-14001 error occurs from system exec.vi only on one machine
I have a LV application that calls an executable that is bundled with the application using the System Exec command.
I have tested it on our computers both pre-compiled and executable with no problems. It has also worked fine on
a variety of customer computers.
But ONE computer from one customer returns a -14001 error. It is a chinese language XP machine.
Any info on this error? Any idea how I might debug it?
Thanks...
-Umar.Error 14001 LabVIEW: Invalid refnum.
Is the customer
doing anything with DDE server, client, or functions? In every case
that we have seen this error at National Instruments it was when a
customer is using DDE. What is the operating system? In more than one
case it was suggested that it was a problem with the operating system.
In one case the customer said that it ended up beiong a Microsoft issue. You could also try contacting Microsoft and ask them if they can tell you how to set the NetDDE permissions differently.
Vince M
Applications Engineer
Maybe you are looking for
-
Error CX_RSR_X_MESSAGE during DTP execution
Hello, I'm trying to load data from PSA into the infocube using DTP All packages have loaded successfully except one with the error CX_RSR_X_MESSAGE Error Message: An exception occurred that was not caught. The exception 'CX_RSR_X_MESSAGE' was raised
-
How do I retrieve an app that I bought. The icon is in my library. But the program isn't in my device. When I look in the file that contains the app and try to open it, it doesn't open.
-
Hi, Is there any System Fields like Sy-(something) that i can call to know the Internal Session ID of the current session?
-
I upgraded to ios 7 and now my phone will not turn on or charge what can I do?
What can I do?
-
Different video formats in same timeline
hey, so i need to edit some clips together that were shot in different formats. im editing prores 422 lt footage that was shot at 108024p with a canon t2i with some ripped dvd clips. im using mpeg streamclip and ripping them as quicktime apple hdv 10