ag1976 Posted October 8, 2012 Report Share Posted October 8, 2012 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 Quote Link to comment
Jordan Kuehn Posted October 8, 2012 Report Share Posted October 8, 2012 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. Quote Link to comment
ShaunR Posted October 9, 2012 Report Share Posted October 9, 2012 You're thinking like a linux user 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. Quote Link to comment
Tim_S Posted October 9, 2012 Report Share Posted October 9, 2012 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. Quote Link to comment
ShaunR Posted October 9, 2012 Report Share Posted October 9, 2012 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 Quote Link to comment
Tim_S Posted October 9, 2012 Report Share Posted October 9, 2012 Your absolutely right, but after that first time you can look at the Doc Open event The number hours I could have saved using that... Quote Link to comment
Ton Plomp Posted October 9, 2012 Report Share Posted October 9, 2012 O and please help us making that event 'official' Ton Quote Link to comment
ag1976 Posted October 12, 2012 Author Report Share Posted October 12, 2012 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? Quote Link to comment
Ton Plomp Posted October 12, 2012 Report Share Posted October 12, 2012 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.