The CHT Blogger

Thanks for your interest in The Clarion Handy Tools, an awesome collection of productivity enhancements for Clarion developers. These tools consist of an ever-expanding set of Clarion Templates and OOP Classes that extend or complement the normal functionality of the Clarion Application Development System from SoftVelocity.

Friday, August 14, 2009

CHT Build 13C1.00 New Features Review Part 7

New Template, EmbedFileNotifyFunctions




embedfilenotifyfunctions.gif



The purpose of this template is to make available in the procedure to which it is attached, a new class called HNDFileNotify. This is a very small, but powerful class which gives your procedure the ability to notify your application via EVENT:FileChanged whenever a new file is added to a nominated directory or a file in the nominated directory is changed in any way.

There are hundreds of uses for this small but powerful feature, from backup applications to autoupload and cross-posting capability. I've provided a small application to illustrate one use.


Example Application Using EmbedFileNotifyFunctions



This application illustrates a new CHT template called EmbedFileNotifyFunctions and a new class called HNDFileNotify(HNDFILENOTIFY.INC/HNDFILENOTIFY.CLW).


monitorapp.gif



The class attached to your procedure by this template, once initialized gives your procedure the ability to detect all changes occuring in a nominated directory. Whenever a new file is added to this directory, or a file is changed, your procedure is sent an event called EVENT:FileChanged to signal that this has occurred. At that point, what you do as a programmer to act on that event is wide open.

This application illustrates one use of this new, directory monitoring capability. When a file is added to the designated source directory, that file is copied into a temporary, processing directory, from where it is compressed and encrypted into a CHT .HZO transport container.

The file or files meeting the filter setting provided on the application interface, eventually then, end up compressed into this .HZO container. There is also an optional switch to remove the processed source file(s) from the directory being
monitored.

Cheers...

Gus Creces
The Clarion Handy Tools Page
www.cwhandy.com
support@cwhandy.com
August 14, 2009