|
![]() |
Smart Rules and Batch Processing |
Not everyone is a coder, perhaps even you. But that doesn't mean you don't have automation needs. DEVONthink has two related technologies that allow you to process your data by constructing a chain of predefined commands smart rules and batch processing. While the former are for more transparent background processes and the latter for handling selected items, both share a common traits and methods. Understanding one leads to understanding the other. Smart Rules Smart rules are smart groups‚ evolved. Built in the same style as smart groups, smart rules don't just show items matching criteria, they can act on them! From something as simple as adding (or changing) a color label, to modifying a filename then filing a document in another location, smart rules provide some powerful automation possibilities. And they're not just for the technically inclined. No programming experience is needed for almost every action available. Smart rules are conceptually simple and can be summed up as follows: When this event occurs > do this action > on items matched > in this location. Smart rules are made of four parts:
Create a smart rule: Smart rules can be created in one of two ways:
Note in either case you can change the Search in parameter to target other locations, including all open databases.
When you create a new smart rule, you will be shown the predicate editor, just as you see with smart groups. Just follow these simple steps to define the parameters of the rule (with an example):
This rule shown above would add "_edited" as a suffix to the name of any edited images whose name begins with "screen". One step further‚ chained actions: If you hadn't noticed, there's a + button to the right of the action you specified. And yes, that means you can chain multiple actions in a smart rule! For example, we could add an action to open the edited imaged in the system default application after it has been renamed. Understanding the input: In a smart rule, there always is only one input. You can't use conditionals or split the actions into a parallel process. A matched document is passed along through the entire process. So if you have a smart rule processing Markdown files and one of your actions is Order of operations: If you have more than one smart rule targeting the same location and/or types of files, they will run in the order they appear in the Navigate sidebar. The topmost rule will execute first, then the second, and so on. Be aware one rule could make a change that affects whether an item is matched by subsequent rules. If it does, those rules logically will not process the items. Drag related smart rules into the order they should run or stop and reconsider how your rules are set up. Chaining smart rules: Creating smart rules with more limited functions is often useful. For example, a rule that just files documents based on a certain custom attribute can be used on selected documents or by drag and drop to the rule. Now say you have another rule with more complex functions, e.g., moving a document into a database, doing OCR, then adding custom metadata. Provided it's using the same custom metadata, instead of adding the same actions as the previous rule, add the Apply Rule action and choose the filing smart rule. Now add another smart rule that should also file things based on the same custom metadata but in a different location. Use the Working Safely: In smart rules, the actions are executed based on the event handler you're using. For testing, set the event trigger to Also be aware the effects of smart rules are very broad, i.e., they affect all the items they match. While you are testing, it's a good idea to put some limiting criterion in place. For example, instead of matching all images in all databases, try matching images in a specific group or only images that begin with "Screen". Batch Processing Smart rules are useful for repetitious actions, usually happening in the background. For times when you need to make impromptu changes on specific items, e.g., prefixing a date to the name of several documents, batch processing is the best option. Select a few documents to process, then choose Tools > Batch Process. The Batch Processing window appears where you can create your chain of actions, just as described for smart rules. Then press OK and the documents are modified. And if this is something you'll do often, you can create new reusable configurations as you need them. Note not every smart action is available in batch processing. However, for most actions the available ones are more than sufficient. Exporting and Importing If you want to share or backup individual smart items, it is easily done. The simplest way to export a smart item is to drag and drop it to the Finder. Smart rules export as To import these items, you can simply double-click the exported file to reinstall it. Alternately, for smart rules, you can also drag and drop directly into the Smart Rules or choose Import from the context menu. For batch configurations, you can drag and drop to the Configurations section of the Batch Process window or choose Import from the context menu or action menu. If you want to share or independently backup all these smart items, you can find the For your reference, there is a complete list of available Events and Actions. For those interested in the using script-based actions, continue to the next section… |