dgorsman

I have a short application developed that scans through our project server, looking for specific files in specific places. If it finds certain files, it calls a command-line application to process the file. It runs on a weekly basis, and all is well.

What I would like to do, is create a companion application for "on-demand" processing. Users would copy the appropriate file into an "in" folder on the network, where it would be automatically processed into an "out" folder before the original is erased. I have seen something similar done with PDF file creation. I am wondering, has anybody here tried this with VS Express, and can you point me in the right direction



Re: Visual Basic Express Edition Folder monitor system

ahmedilyas

well this is totally up to you on how you develop it. Can it be developed yes! how is it developed well depends what your app is wanting to do.

I can tell you that from the sounds of things you will be doing some file processing, therefore the System.IO namespace is the one to look at to perform moving of files, creating files/folders and deleting them.

We need more information to help you on what you are wanting to achieve






Re: Visual Basic Express Edition Folder monitor system

dgorsman

The program will run in the background without any supervision during work hours on the computer that has the licenced application on it. When a file of the appropriate type shows up in the established "in" folder on the network, the program will run the licenced conversion software via a command-line version of the program and put the result in the "out" folder. After the conversion program has finished, I want the original file deleted out of the "in" folder.

I have the conversion code working just fine; what I need is the rest of the program - a means of quietly sitting in the background until a file is available for processing. I could do it with a primitive do-while type of loop, but I'm looking for a more efficient option.





Re: Visual Basic Express Edition Folder monitor system

ahmedilyas

using a do while loop is bad to wait for the file to appear.

  • will consume/waste CPU cycles and will consume 99% CPU therefore apps will be slow and your app will get the most attention but will still be very ineffecient and unprofessional.

    you can make it into a Windows Service however the Express editions do not support creating a Windows Service. you could however hide the form and implement say the Application Exit event, and restart the application if the user forcefully closes the application via task manager for example.

    Now, you can use a file system watcher to watch a directory and implement the events you want to implement when a file has been created/removed etc... so you keep waiting for this event, the event when implemented will fire automatically then you proceed to do your thing, such as running this 3rd party app in the background.

    http://msdn2.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx






  • Re: Visual Basic Express Edition Folder monitor system

    dgorsman

    Makes sense... I'll have a look at doing it that way. Much obliged.