That's what I'd do, though I'd probably punt the monitoring part
out of the folder action script and into a stay-open applet. You
don't really need anything fancy. Something like:
property _kDelay : 2
property _jobQueue : {}
on idle
repeat with oRef in _jobQueue
oRef's process() returning isFinished
if isFinished then set oRef's contents to missing value
end repeat
set _jobQueue to _jobQueue's scripts
return _kDelay
end idle
on process()
set currentSize to size of (info for _file)
set isFinished to currentSize is _previousSize
if isFinished then
--perform backup and write to log
else
set _previousSize to currentSize
end if
return isFinished
end process
end script
set end of _jobQueue to result
end addJob
The folder action script then calls the applet's addJob handler for
each file to be processed.
That's the sort of thing - although your code is far more concise
than anything I'd write - I'll be digesting and learning. Last time I
did this sort of thing I had the folder action handler in the main
(stay-open) applet. When the folder action was poked, it added the
script object to the global queue. Seemed to work quite well.
If you split the stuff out into two separate scripts, how do you pass
the reference across to the stay-open applet. IIRC, you can't pass
arguments between applescript applets.