Quick-stamp resetting $KeyAttributes

We know that option + cmd+ i brings up the “Get info …” pane where in the first column we chose “attributes” and in the second column we search for “KeyAttributes” --> to be displayed in the third column. There we right-click on “KeyAttributes” and then click on “Use Inherited Value”. Works well.

###Question:
Which code to use for either quick-stamping this “use inherited value” or even more desirable: creating a rule for having this “use inherited value”-reset done automatically (for instance: when applying a prototype with specific KeyAttributes to a note brought in from Devonthink that shows different KeyAttributes).

Well?

I’m sure if you can do exactly that, but a stamp can set KAs to be the same as KAs for a specific note:

$KeyAttributes=;$KeyAttributes=$KeyAttributes(/Prototypes/MyPrototype);

1 Like

As in the first part of the answer immediately above, the ‘reset’ is handled by setting the $KeyAttributes attribute:

$KeyAttributes=;

To clarify, the actual action is to set no value, i.e.

$KeyAttributes=

But even if there is no following action, people tend to add a semi-colon regardless as in the first example. Both actions do the same, but the former makes it clear that this is the intent and not just a part completed action.

For quick-stamp, there is a button to reset inheritance - see here.

I’d suggest a rule is sub-optimal for this task as it only needs doing once, better would be to use an edict for automating this. Or, use an agent that only matches DT-generated notes with the ‘wrong’ KAs and thus do the reset function only on those notes that need it.

However, bear in mind that notes created in a DT watched group are assigned a built-in prototype called ‘Imported From DEVONthink’ which sets DT-related KAs by inheritance. Thus you may not need a ‘reset’ at all but simply to apply a different prototype and let inheritance set the desired KAs.

1 Like

Is there any way to reset all attributes that have been emptied? This would facilitate the common task or resetting manually each different attribute that has been changed locally.

If you mean set to no value locally, then ‘No’. You can test individual attributes for having a locally-set value using hasLocalValue("attributeName"[,target]) (explained here). However, there’s no pre-built method to iterate that over every possible attribute a note may posses. If that seems an omission it’s worth bearing in mind action code is not a programming IDE but a set of macros used for textual analysis and export that have grown as needed over time rather than as a pre-planned complete framework.

1 Like