12-06-2011 04:36 AM
Hi all,
I admire your great job Steve! Considering your VIs I wonder if it is possible to use this project to trigger image reading function. Can you give me some clues how to do it?
regards,
Marcin
12-06-2011 07:24 AM
I assume you have something collecting images and placing them in some directory. The <Dir Event> in the event structure will fire whenever a file is created in the specified directory. That event case is where you would start your image reading function. Your actual image reading function is probably going to take some time so it should go in another loop. Use a queue to send notification from the user event to that loop.
After you have processed the image you should delete it or move it to another directory so that you only see the files that are new and have not yet been processed. The example fires an event any time that a file is created, deleted, changed or renamed. You could change it to only fire when the file is created. Notice the Reg Event Callback with a bunch of wires going into it. There are four sections with three wires each. Delete all three wires from the deleted, changed and renamed sections then resize so that only the three wires for the created section are showing.
12-06-2011 01:06 PM
Yes, I want to open images placed in one specified directory. The name of image is date and time and I want to open a file as fast as it arrives.
I don't know if I understand you properly - do I need to use a Generate Event Function to trigger a read_bmp_file.vi?
12-06-2011 04:31 PM
@bikekowal wrote:
Yes, I want to open images placed in one specified directory. The name of image is date and time and I want to open a file as fast as it arrives.
I don't know if I understand you properly - do I need to use a Generate Event Function to trigger a read_bmp_file.vi?
The callback VI will generate the user event. Your code to read the file needs to be placed inside the event structure, in the event case for the user event that is generated when a new file is added to the directory.
02-26-2013 01:43 PM
Hi Steve,
I based my code on the FileSystemWatcher Functions to develop a little application, unfortunately when I build the installer to run it on a non-Labview machine runing XP and wich have the .NetFramework 4.0. The app does not start and provide the following error:" the vi is not executable. the full development version of labview is required to fix the errors"
The application works fine under Windows7 on a non-Labview machine, works obviously fine on a development machine under windows 7 too, but I had no chance making it work on two different XP sp3 non-LabView Machine with .NetFramework 4.0.
After some investigation, removing the .Net references within my VIs, I concluded that for some reason the .Net implementation of this function in LabView is not compatible with some XP components.
Am I right? Or what is the reason?
Do you think there is a workaround?
Thanks a lot.
03-18-2013 08:26 AM
This is a Question for Steve or anyone else that would know the answer.
How can I use this approach to monitor 1 Excel file (called Testfile) instead of a directory. The file will be updating every few milli seconds with different data thats being overwritten. Any time Testfile has new data I need to be notified.
03-19-2013 05:03 PM
Hi *E*,
If you place the Excel file you want to monitor in a directory by itself, you can use Steve's code with few alterations. Simply add your notification action inside the event structure found in 'Dir Watch.vi'. That event structure executes whenever a change is detected in the files contained within the selected folder. I tested it out and a simple 'save' operation in excel triggers a whole bunch of file changes in a row (10ish?), so be prepared for that.
03-19-2013 05:41 PM
Thank you!
03-19-2013 10:29 PM
Glorious! How have I not seen this? I'm glad someone posted a thank you which bumped it. I have written a loop to run in parallel that gets a directory listing when software starts and gets a listing from then on every one second, compares the different files to determine if something is new.
We often do this to handle when new files are FTPd from RT to the Host PC, and then the host PC will move them to network storage.
04-30-2014 12:14 PM
Any ideas on how to do this on a real-time target? As far as I know they don't support .NET? Would I just have to create a VI that polls the dir contents with some frequency and compares the results for differences?