However, the smart rule I made doesn’t work as well as I’d like:
Namely, it’s hard to make it fire only after I’m finished with a file, not while I’m working with it.
Ideally I could set up conditions like:
Date modified is This Hour
Date modified is not in the last 15 minutes
If I’m working with something, I generally make some kind of change to the file at least every fifteen minutes. So the conditions above would fire on a record that has been “put down,” so to speak, but not before.
The “Perform actions after saving” thing kind of works, except many apps like to save often, so I find the rule fires often.
I feel like I’m missing something obvious here. Granted, everyone will have subtle differences in what it means to have “finished with” a file, but I’m hoping I can learn from someone else to apply to my use case.
You could simply add a few lines to the script to check the record hasn’t been edited it the past 15 minutes. Whilst the rule would then still trigger, the script would do nothing,
Ha, thank you for the reminder—I think I’ve actually implemented that in the past…
I went with a heavy-handed approach, to make sure the script doesn’t fire within 15 minutes of interacting with the file whatsoever:
on performSmartRule(theRecords)
repeat with eachRecord in theRecords
set recordModified to eachRecord's modification date
set recordOpened to eachRecord's opening date
set recordCreated to eachRecord's creation date
set recordAdded to eachRecord's addition date
if (((current date) - recordModified) > 15 * minutes) and (((current date) - recordOpened) > 15 * minutes) and (((current date) - recordCreated) > 15 * minutes) and (((current date) - recordAdded) > 15 * minutes) then
-- do something
end if
end repeat
end performSmartRule
Still, it’d be nice if there was a way to do this without entering script-land.
I think the “problem” might be that DT does not really have a concept of saving a record. You edit it, and whatever you do is immediately reflected in the content.
So going for a “has been modified in the last 1h but not the last xx minutes” approach might be the second best choice. If only DT would offer this kind of granularity. Or flexibility, like any time value instead of a fixed list of values.
As much as I of course agree with you (as always ): If DT’s smart rules were a bit less limiting, a lot less scripting would be necessary. Like in this case: You can choose records modified within the last hour, but not withing the last 15 minutes. Simply because there’s no way to specify an arbitrary time value. I’m not sure that I see a technical reason for that, but it is forcing people intro script land unnecessarily, I think.
There are many things that can be accomplished via smart rules in their current state, far more than people give them credit for.
Also, things that lead easily into scripts are likely not very reducable in the first place.
And only @cgrunenberg could comment on the technical issues (which I’m sure are there, even if not immediately known to us).
It’s always a matter of priorities (based on e.g. number of requests, amount of work, impact/visibility/usability of change and for how many users etc.)
Hi Ryan,
Do you have an updated version of the entire script you’d be willing to share. (I’m pretty weak on AppleScript, and I don’t seem to be placing this in the right place).
BTW, great job on the MPU podcast this week!
Ah ok -yes, the annotation extraction script. I’m not sure it will work given that I’m annotating on iPad then using an indexed bookends library (in iCloud), but the reduction in button pushing sounds appealing and smoother than my current Bookends→Drafts (with various strung together actions)→ Obsidian route. Look forward to the post, and apologies for tracking this down here (I’m one of those that nudged you on discord too).
As long as the files, with annotations, are in DEVONthink 3 with smart rules, I think it should work. We’ll see when I get the chance to stitch it together!
Yes, I guess the trick is to have a smart rule or keyboard maestro or something to push the indexing on the main machine. (I don’t always work with my notes on the computer).