Run script when an item is added to a group

Is there a way to run a script when an item is added to a group? Either when moved to the group or when clipped directly to the group.

Since version 3.5 smart rules can use multiple triggers, a combination of On Creation, On Import and On Move should work.

This sounds promising. Thank you.

I assume this (triggers in particular but scripting in general) is documented somewhere. Could you please point me to the right place?

Have you had a look in the Help menu of DT3 (the right most menu entry)? Second entry there is the DEVONThink Help, and there you’ll see “Automate”.

I saw the section a did a cursory inspection of what’s in it. It’s a good overview of the automation in DT but it’s not quite as detailed as I’d like it to be. For instance, it doesn’t mention that smart rules can have multiple triggers and what those triggers are. There’s a single example with a single trigger in the Smart Rules section. And

I’m asking for something closer to an API docs of a library.

For instance, it doesn’t mention that smart rules can have multiple triggers and what those triggers are

It does, indeed:

EVENTS
When an action is triggered is almost as important as the action itself. Actions can be triggered when any of these events occur:

  • On Demand: Run only when Apply Rule is selected in a contextual menu or Tools > Apply Rules.
  • On Startup: Runs when DEVONthink launches.
  • Before Synchronization: Runs all actions before DEVONthink begins synchronizing to any sync location.

    You can and and remove multiple event triggers by pressing the + or - buttons. Fox example, you could use an On Import and an On Moving event trigger to act on files imported or moved into it.

I suggest a not so cursory dive into the documentation. It really answers many questions, but one has to read it.

As to the API: you can use the usual suspects to write your own scripts for smart rules, namely JavaScript and AppleScript. And those are documented as always: In the corresponding script dictionaries. Which is fine for the initiated and anything but for everybody else.

So I suggest that you have a look at the automation sub-forum to get some ideas about the scripting (im-)possibilities.

Hi,
someone know how to check against a condition about the enclosing group?
maybe by script?

You’d need to use a script or target the parent folder specifically.

Why - what are you doing?

I would to be able to set dragged items metadata, if the enclosing group match some condition. e.g. metadata content

Post a screen capture as it’s unclear what you mean by “enclosing folder”. I’m not sure if you’re referring to the group a file is in or the parent group of the group a file is in.

sorry, i’m referring to the group a file is in.

Hi,
someone know how to check against a condition about the group an item is in?
maybe by script?

Scripting is the only possibility.

Here is a simple example…

thanks

No problem