I’d like to be able to drop a document onto a special folder and have the document be Excluded From both Classification and See Also (but not from Search). I can’t see how to make a Smart Rule for that, so is a script the only option?
If the latter, I’d be grateful to have one; I imagine it would be very short.
Here’s a quick script that sets those options on selected files…
tell application id "DNtp"
repeat with thisRecord in (selected records)
set exclude from see also of thisRecord to true
set exclude from classification of thisRecord to true
end repeat
end tell
I’ve a Group I call TARTARUS whose contents I want to keep in the database but Exclude from Classification and See Also. I’d like to be able to just drop any Document or set of Documents on that Group and have them be so excluded.
E.g. a smart rule could be performed On Importing and On Moving and execute a similar script:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
set exclude from see also of theRecord to true
set exclude from classification of theRecord to true
end repeat
end tell
end performSmartRule
As Gildor, I like to recursively exclude all files and groups within a certain group from wiki-linking. First I just marked the group to be excluded from this linking and expected DT to do all the magic. Then I realized, this only works for the group itself and I have to do this somehow for every file within the group. [Wouldn’t that be a great feature, if DT could do this, by the way?]
As I read above, there is now a smart rule & a script to automate this. But I don’t know how to do it concretely.
First I tried to make a smart group to list all the files within that certain group (and subgroups) that are not yet exluded from wiki-linking to then convert that into a smart rule with the script above. But I am even not able to define such a smart group / rule from the start.
So, what is the best approach and how do you do this??
OK, I managed to take a little step further. This is what I did:
Defined a new Smart Rule assigned to a specific folder (“Bibliothek” in my case)
Set the trigger to “On Import” & “On Moving”
Attached the following AppleScript:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
-- set exclude from classification of theRecord to true
-- set exclude from see also of theRecord to true
-- set exclude from search of theRecord to true
set exclude from Wiki linking of theRecord to true
end repeat
end tell
end performSmartRule
So far so good: every file, that is moved into the folder “Bibliothek” now is excluded from Wiki-Linking!
Still, if I move a file out of my “Bibliothek” it stays excluded from Wiki-Linking. I didn’t find a possibility to define the search like everything except “Bibliothek” for an additional SmartRule (re)enabling Wiki-Linking. Also there ist no criteria like path to define such an idea.
Go into File > Database Properties and enable Inherit Tags of Groups.
Add a tag to the Bibliothek group, e.g., No WikiLink. Every item in that group will inherit this tag. When the file moves out of the group, the tag will be removed.
And here is a smart rule, targeting the parent of the Bibliothek group, that works as expected…
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
tell theRecord
if (tags of it contains "No WikiLink") then
set exclude from Wiki linking to true
else
set exclude from Wiki linking to false
end if
end tell
end repeat
end tell
end performSmartRule
I tried another approach with tags. I liked this idea as it makes things even more flexible.
In the database properties there is an option to inherit tags of groups which seems useful. As soon as I tag a group with a tag like “No Wiki-Link” all items within that group get that tag recursively. Great! Therefore I defined two appropriate smart rules for setting and resetting the option Exclude from Wiki Linking with an appropriate Apple Script like above:
Now the group that manually gets the tag “No Wiki-Link” (removed) gets the option “Exlude from Wiki Linking” (removed) automatically. But ist not happening to all the items in inside the group: they have the tag, but not the appropriate option. If I apply the smart rule manually (via context menu) to all entries though, all items in that group get the option set correctly.
So I assume that DT only passes the original group to the Apple script when tagging, but not the elements that receive the tag recursively. That makes sense from a performance perspective, but doesn’t help here.
So in the end, I am able to set the “Exclude from Wiki Linking” option as described im my previous post, but I’m not able to reset the option once the file gets moved out of that group.
Did I miss something or do you have any more clues?
You’re welcome.
I had considered it could require two smart rules, but felt that wasn’t elegant enough and also a bit overbearing for such a minor operation.
Thanks Bluefrog once more!
I tried your approach and it’s much nicer to have it all in one smart rule indeed. I added the trigger “On tagging” for my purpose. Still, the rule struggles with the same problem as I posted above (in parallel to your post): Smart rule for "Exclude From…"? - #14 by Farath.
Just the group, that is tagged, moved or imported gets the option set correctly, but not the items inside the group. So the rule doesn’t work recursively until I start it manually.
I added another trigger “On startup”. So if there is a mismatch, it will be corrected when I start DT, which is sufficient for me. DT is so performant on this. I have over 1600 items in my “Bibliothek” and DT runs the rule literally instantly.
You’re welcome! And no, the rule would not have applied the rule recursively since there would be no matching event trigger. Your additional triggers are a good option.