Jump to content

How to execute a executable program from LabVIEW?


Recommended Posts

So this again is one of those suggestions I have, just because I've gotten it to work, not because it is the right or only way of doing it.

In the past I wrote a LabVIEW application which would do a Read Characters from file, and point it to a EXE file. This would basically read the ascii string interpretation of the file (I think a binary read would also work for this). I then took the read content and saved it as a string constant on the block diagram of a new LabVIEW VI. Then when you ran my second VI I would take the string constant, and write it to a file in a temp location (because I would have write privileges). Then I would use the system exec and run the EXE I just wrote to file.

This process has several problems associated with it including the potential for distributing viruses or other malicious applications, in source code. Generally we think of source code as safe, because we can see all what it is doing, but with this method you can write any program within LabVIEW to file and run it.

Other problems of course is it's messy and unintuitive. Why would you not just want to distribute your LabVIEW program along side your 3rd party application? You can even build an installer that includes the 3rd party program and makes a shortcut to only your LabVIEW program.

Link to comment

Thank you very much! Rayan

Let me try that way first.

Not sure what you're looking for, but the System Exec.vi is only way I know of to launch an EXE. Communicating with the EXE is a different matter and dependent on the EXE. There is no way I know of the embed and exe in a VI only call one.

Thank you very much! Ryan

Let me try that way first.

Not sure what you're looking for, but the System Exec.vi is only way I know of to launch an EXE. Communicating with the EXE is a different matter and dependent on the EXE. There is no way I know of the embed and exe in a VI only call one.

Link to comment

Hoovahh,

Thank you very much for the reply!

Actually, I don't really want the whole third party program to be embedded in my VI. I just want that on the front panel of my VI, after I press one button or select one item in the menu, I can run the third party EXE program. I think that would be what you suggested "makes a shortcut to only your LabVIEW program." However, would you please tell me how can I run the third party program with a shortcut to only my LabVIEW program? For example, how can I embedded a pointer (that point to the third party program) in the Case Structure or Event Structure. If you have example, would you please send me one? My email address: yananxiao@gmail.com

Thank you again !! and looking forward your reply

Yanan

So this again is one of those suggestions I have, just because I've gotten it to work, not because it is the right or only way of doing it.

In the past I wrote a LabVIEW application which would do a Read Characters from file, and point it to a EXE file. This would basically read the ascii string interpretation of the file (I think a binary read would also work for this). I then took the read content and saved it as a string constant on the block diagram of a new LabVIEW VI. Then when you ran my second VI I would take the string constant, and write it to a file in a temp location (because I would have write privileges). Then I would use the system exec and run the EXE I just wrote to file.

This process has several problems associated with it including the potential for distributing viruses or other malicious applications, in source code. Generally we think of source code as safe, because we can see all what it is doing, but with this method you can write any program within LabVIEW to file and run it.

Other problems of course is it's messy and unintuitive. Why would you not just want to distribute your LabVIEW program along side your 3rd party application? You can even build an installer that includes the 3rd party program and makes a shortcut to only your LabVIEW program.

Link to comment

Hoovahh,

Thank you very much for the reply!

Actually, I don't really want the whole third party program to be embedded in my VI. I just want that on the front panel of my VI, after I press one button or select one item in the menu, I can run the third party EXE program. I think that would be what you suggested "makes a shortcut to only your LabVIEW program." However, would you please tell me how can I run the third party program with a shortcut to only my LabVIEW program? For example, how can I embedded a pointer (that point to the third party program) in the Case Structure or Event Structure. If you have example, would you please send me one? My email address: yananxiao@gmail.com

Thank you again !! and looking forward your reply

Yanan

I'm not going to email you the answer the is a public forum for members to share their knowledge with everyone not to just one person.

In any case just use the System Exec.vi function found in the Connectivity >> Libraries & Executables. Pass it the path to a file and it will execute it as if someone double clicked it. Other than that I'd recommend taking some LabVIEW courses, reading some training manuals and looking over the shipped examples that come with LabVIEW. Someone who has done these things should be able to come up with your program in about the time it took for you to ask the question.

  • Like 1
Link to comment

Thank you very much!

This information is more than enough

I'm not going to email you the answer the is a public forum for members to share their knowledge with everyone not to just one person.

In any case just use the System Exec.vi function found in the Connectivity >> Libraries & Executables. Pass it the path to a file and it will execute it as if someone double clicked it. Other than that I'd recommend taking some LabVIEW courses, reading some training manuals and looking over the shipped examples that come with LabVIEW. Someone who has done these things should be able to come up with your program in about the time it took for you to ask the question.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.