MarcEdit 7: Watch Folders

I’ve been spending a lot of time working on a new feature for MarcEdit 7 — Watch Folders.  The idea behind this concept is that users may have files that they get regularly from vendors, staff, etc. that are part of a specific workflow.  Rather than having to open each file into MarcEdit in order to process the data — the idea behind watch folders is that MarcEdit will essentially “watch” particular folders and then process the data according to the criteria set forth.  Right now, this criteria is primarily tasks that can be run against a file — but as I’m working on the first release, I might try to extend this option beyond tasks to character and format conversions (though we’ll have to see).

Folder Watchers

Eventually, folder watchers will be enabled through the preferences.  Users will enable the watcher, and the program will automatically place into the system a command that will restart MarcEdit’s watcher service any time the system starts.  For now, while I’m working on testing, Folder Watchers will be enabled via the Help menu:

image

When a Watcher is enabled — MarcEdit initiates the watcher service.  While testing, this service must be started manually.  Once testing completes, users will be allowed to enable the watcher to start automatically.

When the watcher starts, users will see the following in their icon bar:

image

Right clicking on this icon will show three menu items:

  1. Notifications [all notifications created during a session are saved]
  2. Settings [Open the application preferences]
  3. Exit [Stop the service]

Configuring a Watcher

Watchers will be configured through the Preferences.  To configure a watcher, you enter the Preferences window and select the Configure Watcher link.

image

If you select this option, you will see the following options:

image

Any Watchers that are configured, will be in the list.  From there, you can delete or edit a watcher.  Notice the Enable Watch Folder Service — eventually, this option will cause the program to install the service to autostart.  During testing, this option won’t do anything.

Adding a Watcher, you see the following options:

image

Couple things to notice —

  1. Folders to process can process all data, specific files matching a pattern, and folders and subfolders. 
  2. Currently, Tasks are the only attached processes — but I’m looking at adding others.

Once set, you save the file and it will save into the Preferences and is loaded for use if the watcher service is enabled.

Processed File Behavior

The Watcher service will evaluate the designated Folder every 15 minutes.  If data is found matching one of the criteria specified in a watcher, the program will:

  1. Move the file to be processed into the [Folder]\_originals folder.  This folder is special, and will *not* be processed by the watcher and is where data is stored so the user still has access to the original source file.
  2. Finished file is moved to the finished folder + filename[yyyy_mm_dd_hhmmss].[extension]
  3. Notifications will be logged and displayed as a tooltip in over the MarcEdit Service Icon.

Work still to do:

As I was testing this afternoon, I realized a couple things need to be worked out.

  1. What happens when a user restarts their computer while a file is being processed.  I can submit a message to Windows to cause the system to ask the user if they want to restart now or wait till the process is completed.  I can also intercept the restart message, kill a process, and move the file being processed back into the to process folder.  Still working on what this behavior should be.
  2. Installing MarcEdit updates requires the application and service to stop.  This is currently a problem that I need to fix before moving forward.

If you have questions about this work, let me know.

–tr


Posted

in

by

Tags: