Hej to all…
i want to automate the Command “Update indexed objects” in a rule in DT3.
Is there a possibility to run this Command at the last Command in a Rule in DT3? I could not find something to do this?
I would be very pleased about a feedback from you.
Best
Rolf
There is no smart action for this, only and scripting command. What are you trying to do?
Why is this necessary? (What is the use case? What does the rest of the smart rule do?)
Since DEVONthink comes with the script Update indexed items of all databases, it should be possible with a smart rule script. DT’s AppleScript dictionary includes the command synchronize
:
I don’t know AppleScript, but I would like to learn. My total beginner (and untested) attempt would be something like:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
if theRecord is indexed then
synchronize record theRecord -- Updates children of theRecord too
end if
end repeat
end tell
end performSmartRule
How does that look to someone who knows what they’re doing?
(PS: no AI involved, only looking at the included scripts and the manual )
I’d limit the smart rule to indexed records and remove the check if theRecord is indexed
. If I were using AppleScript, that is
But perhaps simply looping over all open databases and synchronizing them is more performant if there are lots of indexed records.
I use the following script in a smart rule that runs on DT start up:
on performSmartRule(theRecords)
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 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
1 Like
I also think that makes more sense. But we don’t know the rest of @HaubenTaucher 's smart rule.
@BLUEFROG @troejgaard
Thanks for your detailed Feedback.
I scan some Documents with a Scannersoftware to a folder. This folder is controlled by Hazel and add some tags and do movements.
If some criteria are fulfilled on that Scan a Rule in DT3 starts the OCR by Abby (for this doings i created a new database - so i have this behavior only on this DB). If Abby finished it’s work i save the document and add additonal tags like “ocr_abby”. After that process Hazel overtakes the next steps to move and rename the document. And this creates elements in the database which i can cleanup with “update indexed objects” on this database. I can run it manually, but thats not my thought of a digital process…