Jump to content

Data viewer, add datafile path to the viewer


ag1976

Recommended Posts

Hello,

I would need to prepare program for visualizing data with certain extension e.g. "*.dat".

My idea was to create one program called e.g. "data_viewer.exe"

Second program called "add_file_to_data_viewer.exe".

Idea is that in the moment I click on *.dat file (I use windows 7), program "add_file_to_data_viewer.exe" starts "data_viewer.exe" (if need) and add file path to "data_viewer.exe". After it "add_file_to_data_viewer.exe" is closed.

When I click on another *.dat file, "add_file_to_data_viewer.exe" adds second file path to the "data_viewer.exe" and so on.

Only one instance of "data_viewer.exe" is allowed.

Question what is the best way to communicate between "add_file_to_data_viewer.exe" and "data_viewer.exe"?

Is it possible to do it without "add_file_to_data_viewer.exe" program?

Thank you for any suggestions or ideas

Regards

Andrzej

Link to comment

You could store these data paths on disk in a file. Quickest solution would be to have your data_viewer.exe monitor the file for changes and update itself as needed. Alternatively, without the add_file_to_data_viewer.exe you can use an event structure in your main program that monitors for a value changed event on a front panel boolean. When this event fires you can prompt the user for a file path dialog and update your path list as needed. If you want your list to persist between executions it is still good to save it to disk and load it during initialization.

Link to comment

You don't really need to have an add_file program. When you double-click on the file you can pass the file path directly to the viewer as a command-line argument which can be read by LabViEW.

That would work with the first instance of data_viewer.exe, but not if it was already open (since there is a single instance requirement). The data_viewer.exe could allow multiple instances, pass off the command line through another method to an existing instance, then self-terminate. This could be low-overhead if it was done similar to a splash screen.

Link to comment

That would work with the first instance of data_viewer.exe, but not if it was already open (since there is a single instance requirement). The data_viewer.exe could allow multiple instances, pass off the command line through another method to an existing instance, then self-terminate. This could be low-overhead if it was done similar to a splash screen.

Your absolutely right, but after that first time you can look at the Doc Open event

Link to comment

Thanks a lot for your help. I tried to solve this problem with shared variables and it seems to works. But as always there is another problem how to close add_file_to_data_viewer.exe window after it runs data_viewer.exe. I though it would be trivial problem to code but it is not.

Anyway thanks for your help (if you have any other idea or examples how to solve it would be great)

Regards

Andrzej

Your absolutely right, but after that first time you can look at the Doc Open event

I don't know how it would help?

Link to comment

Thanks a lot for your help. I tried to solve this problem with shared variables and it seems to works. But as always there is another problem how to close add_file_to_data_viewer.exe window after it runs data_viewer.exe. I though it would be trivial problem to code but it is not.

Anyway thanks for your help (if you have any other idea or examples how to solve it would be great)

I don't know how it would help?

For closing, you only need to close all the open Front Panels of an EXE, that will close the executable.

And maybe we didn't understood your problem correctly.

Ton

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.