In a recent thread, a very useful script was posted:
[url]Updating indexed groups across many databases]
If the variable “pAllRecords” is set to “true” in the script, it will update all indexed folders in all open databases. I find this indispensable, mostly for making sure that all DBs are up-to-date before syncing to DTTG, e.g. prior to a trip. The script is now part of the suite that comes with DTPO (but note that the default setting for “pAllRecords” is “false”)
Personally, I have another procedure that I would like to automate: For various reasons, I ended up with deciding that I would not keep DTPO-internal files inside indexed folders. So whenever I have an internal item ending up in an indexed folder, I “export” the item to the indexed folder. Obviously, this is tedious.
In another, recent thread, a triggered script was described, that, when attached to the indexed folder would take care of automatically exporting (or deconsolidating, as it is called in the DTPO AppleScript dictionary).
[url]Devonthink Pro Office - Indexing Files Sync]
However, this still requires manually attaching the script to each indexed folder you bring into DTPO. For someone like me who decided that indexed folders will only contain indexed items, this can also be automated across all databases.
The script described at the top already traverses all paths in all open databases to look for indexed folders, for updating them. One can then include the deconsolidation command in the same loop, to update indexed items and deconsolidate internal items at the same time.
I’ve preliminarily tested the resulting script:
-- Update indexed items of all databases -- Created by Christian Grunenberg on Tue Mar 25 2014. -- Copyright (c) 2014. All rights reserved. -- Added automatic deconsolidation of internal items that reside in indexed folders. Only use this if you want ALL items inside indexed folders to be indexed. -- gg378, 26-Sep-2014 -- Set to true if indexed items are not only located at the root of the database property pAllRecords : true tell application id "DNtp" try set theDatabases to databases show progress indicator "Updating Indexed Items" steps (count of theDatabases) repeat with theDatabase in theDatabases step progress indicator (name of theDatabase as string) set theRecords to records of theDatabase -- Children of root repeat with theRecord in theRecords if pAllRecords or theRecord is indexed then synchronize record theRecord -- Updates children of theRecord too deconsolidate record theRecord -- Export internal files in indexed folders end if end repeat end repeat hide progress indicator on error error_message number error_number hide progress indicator if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning end try end tell
It seems to work as described, but I’d like to hear the opinion of the scripting experts.