LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the number of labview executables/instances running?

Hi,

 

I need help in finding out the number of labview instances running.

 

The exe is used to open an application that monitors data through TCP/IP connection. 

 

The exe is opened multiple times to connect and monitor data from multiple systems.

 

I need to save some static information like ip address, port number, log file path etc...that the user enters and give the same to the user when he closes and opens the application next time.

 

This can be done by saving all the required information to a configuration file (eg: text file) when the application is closed and retrieve the information when it is opened again. 

 

But how this can be done if there are multiple instances of the application are opened ? Can we know the number of instances that are currently running? Can we name each new instance when opened is opened with a new name?

 

Kindly help me out.

 

Thanks for your time,

Arvinth

0 Kudos
Message 1 of 10
(3,838 Views)

I don't quite understand the bit about the static information, and what you mean by "give to the user". But, if you just want to find out what applications are running, a simple System Exec call to the appropriate OS command will do that. For example, tasklist on Windows OS will return the list of tasks which you can then just parse. You can also use .NET if you're feeling particularly adventurous. Examples of both of these have been posted before.

0 Kudos
Message 2 of 10
(3,809 Views)

Thanks for your time and reply Smercurio.

 

The tool needs some input from the user for using it. For eg: IP address, Port number, Log file path to store the messages in text file etc..

 

This data is the information that the user expects to be present when he closes the tool (LabView executable) and opens it again. For a single instance, this is done by saving these information in a configuration file(.txt format). The configuration file is modified with last data present every time when tool is closed and invoked when the tool is opened.

 

Now, in case of multi instance several instances of the tool will be opened and used with different IP address, port number etc.. How to do the previous operation of saving the information from each instance and invoke them ?

 

Thanks for your time,

 

Regards,

Arvinth

0 Kudos
Message 3 of 10
(3,772 Views)

How are you supposed to know which set to recall? For instance, let's say you are able to save each set independently based on each instance of the application. So, let's say you run the app once, the user enters some information. Now, you leave that running, and open another instance. The user enters some information. You quite this second instance. The set of information gets saved (somehow). Then you go and quite the first instance of the app. Now you launch the app again. Which set is supposed to be loaded? The one saved by the second instance of the app, or the first instance?

0 Kudos
Message 4 of 10
(3,761 Views)

You can have a sepperate config file for each instance.  When I need to do this I will launch the exe from a shortcut or the command line and pass an arguement to the exe which tells it which instance it is.  I then use this to open the correct config file.  In LabVIEW you need to tick the "enable command line arrguements" box in the application builder settings.  The arguements can be read using a property node linked to Application.

Hope this helps,

Michael

0 Kudos
Message 5 of 10
(3,733 Views)

I'm not sure if I got your intention right, but if you are willing to use the former private functionalities that come with VI scripting, check this thread on LAVA.

 

Felix

0 Kudos
Message 6 of 10
(3,708 Views)

This problem is fairly easy to address if you launch all your executables into the same runtime.  They can then communicate with each other using standard protocols.  Check out this post for how to launch multiple executables into the same runtime.  You probably want to make your top level VI a .VIT, so you create a new instance every time you launch.  In addition, in the executable INI file, add the line "AllowMultipleInstances=true".  You end up with essentially many independent threads doing the same thing.

 

Given the above, the easiest way to share information is using an action engine.  Every executable uses the same action engine, which caches the information of who is using what.

 

Launching into the same run-time does introduce other issues, however.  Named reference objects (e.g. globals or named queues and notifiers) become problematic.  This is one of the many reasons I avoid named reference objects.

0 Kudos
Message 7 of 10
(3,684 Views)

Sorry for the late reply as I was away from work place for training.

 

We need to have some option in the config file to say this the file is for instance 1 or 2 or etc or by file name.. so that we can take the respective config file for the instances.

0 Kudos
Message 8 of 10
(3,599 Views)

Sorry everyone for the late reply as I was away from work place for training. Thanks all for your time.

 

Smercurio,

 

We need to have some option in the config file to say this the file is for instance 1 or 2 or etc or by file name.. so that we can take the respective config file for the instances.

 

Micheal,

 

Can you help me how we to use this functionality in labview? or do you have any example Vi's for this ?

 

Thanks Gray and Felix,

 

I will go through the link and get back.

 

 

0 Kudos
Message 9 of 10
(3,593 Views)

Hi Guys,

I have put together this example for you. Add the following lines to the ini file generated by labview:

 

useTaskBar=False
AllowMultipleInstances=True

 

I have shown the exe's being launched by windows shortcuts, you can also do the same thing from the command line, so you could write a VI to do the launching for you using the command line VI.

 

I hope the example is clear to you, if you need any more help then feel free to ask.

 

Michael.

0 Kudos
Message 10 of 10
(3,582 Views)