LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview does not run an external exe on the first time

Hi,

 

I have a LabView code that runs an external .exe. It works great with no problem when I am developing the code, however, after I have built an installer and deploy the package to a target computer, it does not run the external .exe for the first time!

 

If I go to the installation directory and run the .exe myself and then close it (a simple check to see if my exe has been deployed properly), then the next time I run my labview application it runs the external exe with no problem at all!

 

Even, if after installation is complete, I go to the installation folder, run my external exe and close it, and then run the labview application, it will work.

 

Now the question is that what is the issue with running the external exe programatically for the very first time through labview? It is not OK to go and tell my customers that hey, after installation, go to this folder, run that .exe, then close it and then start using your software.

 

This has happened on multiple machines, all running "Win 7 pro".

0 Kudos
Message 1 of 18
(3,444 Views)

Hi, is this a third party executable you're trying to run?  Can you please try to clarify this for me?  Thanks a lot.

Jonathan R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 18
(3,411 Views)
You talk about an external.exe, but then mention your LabVIEW application. Is the external.exe written in LabVIEW? When you say the LabVIEW application do you mean a standalone program created with LabVIEW, it the LabVIEW development system? Is LabVIEW supposed to be running this separate executable? When you don't run the executable manually once, what happens?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 18
(3,401 Views)

Thanks Kimchi and Mike,

 

We have an inhouse LabView application (Lets say "A_by_LV.exe") that we have developed and is compiled as an EXE and is packed into an installer package lets say "Main App"."A_by_LV" is the main project/executable of "Main App".

 

 

We have another exe that we have developed in C# (lets call it B_by_CS.exe) and is packed by the labview installer in the same package az the rest of the stuff in "Main App" and is located under the same directory as "A_by_LV". So something like: "C:\program files (x86)\Main App\".

 

What A_by_LV" does is to get a bunch of info from the user, create some text files and then run B_by_CS. B_by_CS will look into these files and do some processing. If those files are corrupted or not there, B_by_CS is designed in a way to give some warnings and use some default values. It will not crash or hang. Also, we have verified that .txt's are there and in the pabview code, all the process upto "what is my current folder, what is the .exe that needs to run" Start this process works ALWAYS (using some debug logging)

 

The first time you run A_by_LV, it starts fine, you input the variables, the text files are being genreated and then program closes without running B_by_CS.exe. again in the debugs we can see that the corresponding code was called. and if we go run B_by_CS manually it starts, works fine and then after that every time you finish using A_by_LV, it executes B_by_CS as expected.

 

It seems to me that it could be a settings or security or OS issue?  any thoughts?

 

 

0 Kudos
Message 4 of 18
(3,379 Views)

now why half of the code is in LV, the other half is in CS, it was not a decision or design option by me! Smiley Very Happy

Message 5 of 18
(3,376 Views)

Hello, were there any error messages that popped up?  Do you have a 32- or 64-bit LabVIEW?  What version do you have and what versions (LabVIEW, Run-Time Engine do your clients have.  Thanks.

Jonathan R.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 18
(3,329 Views)

Hello Kimchi,

 

I run LabView 2012 SP1 32bits,

The development machine has labview runtime engine: 8.2.1, 8.5.1, 8.6.1, 2009 SP1 (64-it), 2009 SP1 (f6), 2010 SP1, 2010 SP1 (64Bit), 2011 SP1 f2, 2011SP1 f5,

target machine has: 8.6.1, 2009 SP1 f6, 2012 SP1 f5.

 

One more thing, this happens on my development machine as well. If I install the app that I have made and run it, it wont run the external .exe for the very first time.

 

Thanks.

0 Kudos
Message 7 of 18
(3,293 Views)

Hello Kimchi,,

Any new thoughts on this issue??

0 Kudos
Message 8 of 18
(3,173 Views)

Sounds to me like the problem is within the external EXE. Is there any possibility that you can hook up a debugger on the C# application, to see where it fails? Perhaps the problem is related to the working directory from which it runs on the first call. When you run it from LabVIEW, the working directory is probably the directory that contains the LabVIEW application. If that's different than the folder that contains the C# application, and the C# application tries to write some files on the first run without checking the path carefully, that could be the problem.

 

As an experiment, on the first run, instead of going to the folder that contains the C# application, instead open a command-line window, change directory to the folder that contains the LabVIEW application, then run the C# application from there (that is, at the command line, enter something like ..\...\path_to_app\csharpapp.exe). Does it work, or give you an error?

Message 9 of 18
(3,163 Views)

Thanks Nathan for your reply.

 

This is a very itneresting hypothesis and I will test and let you know.

However, the external .exe does not do anything special at the first time it is run! it works the same way all the time, so it does not explain why it does not run the first time and why it runs after wards. Anyways, I will put debugs in it and see if the problem lies in there. this test takes very long every time because I ahve to modify the external file to put debugs in it and create installer, uninstall the old one, re-install the new one, restart the PC, run the labview and see what happens.

 

But thanks and I will keep you updated as soon as I figured the problem.

0 Kudos
Message 10 of 18
(3,155 Views)