LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Passing Command Line Arguments In While VI EXE is already running

Hello,

 

I am Making a simple application that reads and displays a specific type of file. When I am  opening any file through that exe using 'open with' option the file is opened using exe (as I have used command line arguments at startup of exe and path of file appears in array of command line arguments) now I am opening second file using 'open with' option(this time exe is already running) and application is continuously reading command line arguments. but this time, path of file do not come in arguments and arguments remain unchanged. So application is not able to find path of second file which needs to be open through 'Open with' option. Please suggest solution.

 

Thanks 

Saurabh P.

0 Kudos
Message 1 of 7
(1,976 Views)

Hi Saurabh,

 

you can allow multiple instances of your exe, so with each 'open with' call a new instance is opened...

 

Or you create a small tool which reads the command line arguments and sends them to the running instance of your exe using network communication.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,966 Views)

A LabVIEW executable is not a command line application. The command line is only updated when the application is started.

 

You can (should) use the OS Open Document and OS Open Document? events. Those events get called whenever the user drops a file on the (shortcut of the) executable.

 

If you really want your application to act as a command line application, you'll find discussions about this on the forum. It has been asked many times...

0 Kudos
Message 3 of 7
(1,907 Views)

Hi wiebe,

 

where do I find those events?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(1,902 Views)

Did I enable something naughty?

 

Anyway, they are Application events... You might need to turn scripting on, or maybe some other key. Here they are, although I'm not sure how useful the static events are:

OS Open Document Events.png

0 Kudos
Message 5 of 7
(1,896 Views)

Hi wiebe,

 

You might need to turn scripting on, or maybe some other key.

That might be the reason I don't find them in my LV2017 installation.

Neither in the event structure nor at the RegisterEvents node…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(1,892 Views)

@GerdW wrote:

Hi wiebe,

 

You might need to turn scripting on, or maybe some other key.

That might be the reason I don't find them in my LV2017 installation.

Neither in the event structure nor at the RegisterEvents node…


Those two go together. I included the dynamic event registrations in the snippet so you can use the events without enabling scripting (or whatever I enabled). The event structure can be used of course, but it would not be possible to add to an existing event structure.

0 Kudos
Message 7 of 7
(1,888 Views)