externals

Richard Gaskin ambassador at fourthworld.com
Wed Jan 21 12:10:10 EST 2009


viktoras wrote:
> why not instead let user choose folders or files that should be 
> monitored and then monitor these by comparing files (get files etc...), 
> folders (get folders) regularly. Use recursion to get into sub folders, 
> etc. Revolution is fast enough to do this efficiently.

That's an excellent idea.  I was curious about how responsive it would 
be, so I took a couple minutes to throw together an example of this and 
it seems reasonably efficient.

I've posted the example to RevNet - in Rev, choose 
Development->Plugins->GoRevNet, and in RevNet look for "4W Folder 
Watcher" in the Stacks section.

This modest example lets you pick a folder and it checks for changes to 
files (name, size, additions, deletions).  It also provides a slider to 
govern the interval between checks so you can experiment to find the 
best balance between system overhead and responsiveness.

One useful aspect of it is that the folder watching hander accepts the 
name of a callback handler as a param, so you can handle the change 
event however you like without having to modify the folder watcher 
handler itself.

This is a very simple example, with lots of room for improvements like 
also checking folder changes within the target folder, and possibly 
sending additional info about exactly what changed to the callback 
handler if needed.

But as a quick-n-dirty experiment, at least it shows that Rev can be 
used to monitor changes to folder contents with relative ease and 
acceptable efficiency for many uses, and on all supported platforms.

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the Use-livecode mailing list