Tinderbox Forum

AutoFetchCommand, OnAdd for a watched folder in the finder

Hi,
will the AutoFetchCommand event fire for the container connected to the WatchFolder or will the OnAdd action fire if new notes get imported into the WatchFolder container?
I need to manipulate the notes getting imported. Works fine if I import from an URL but not for the Finder?!
Thanks!

Watched folders fetch when Tinderbox chooses, i.e. you don’t get to choose, if that’s the reason for trying to use it there.

As ‘watched’ content isn’t an auto-fetch process I’d not expect AutoFetchCommand. You can always try. If it works, then good, but likely by happy accident. If it doesn’t work, then I think I’ve just explained the likely reason why.

OnAdd seems the logical place to add code you want to apply to new content. But—as too busy to build a test just now—you may hit an edge case where watch updates an existing note. IIRC, this is why watched notes are read-only. Tinderbox isn’t doing a full 2-way sync but rather making a Tinderbox-compatible version of the watched source’s data. If the source changes, the next ‘watch’ event either updates the watched folder note or replaces it with a fresh note. Which of those occurs (new vs. update) occurs is behind-the-curtain so one for @eastgate. Only a (re)new(ed) note would trigger $OnAdd as it is effectively a new one (with a new $ID, etc.) even though this may not be obvious to the user unless they view $ID.

If you do test any of these aspects and get a more definite answer do post back and I’ll add a note to pertinent parts of aTbRef.

Hi Mark, I tested and neither AutoFetchCommand nor OnAdd will be fired. Even for the first time a note get’s created in the WatchFolder no OnAdd will be called.
An $Edict will do what I nee - I wanted to limit the calls to the function using a specific event - but $Edict works.
Thanks for your help!

1 Like

Interesting. Thanks for the info - I’d assumed OnAdd would fire at least once per note creation.

Glad Edict works for you. Once you know you need something to happen but not all the time, moving action from a Rule to an Edict is, I find, helpful. Plus, edicts can be run on demand if you just can’t wait to for next auto-run of the edict.

1 Like