Synchronize Indexed Folder using AppleScript

I am trying to write an AppleScript which will update an indexed folder. I found an old post ( which suggests that this should work:-

tell application "DEVONthink Pro"
	set myPath to "/Users/mark/Recipies"
	set theRecord to get record at myPath
	synchronize record theRecord
end tell

However it doesn’t… DTPro doesn’t update that folder. The path is definitely correct. AppleScript editor gives a result of ‘false’ (presumably consistent with the fact that DTPro isn’t syncing). The result of ‘theRecord’ is just ‘missing value’ which doesn’t look right either.

Any suggestions as to what I am doing wrong?



There is a script to synchronize an indexed folder included in the Extras folder of the DEVONthink disk download. Attach the script to the indexed folder(s) in DEVONthink, and they will be updated when the folders are selected. Will this do what you are looking for?


You’ve misspelled “recipes.” Could that be the problem?


@greg_jones - thanks for pointing that out. I should have mentioned that I have already got that script working, but as far as I can tell it only works if DTPro is running (ie. if I add a new file when DTPro is not running, DTPro doesn’t notice the new file and trigger the script when I do start DTPro - hence the desire to have a separate script so I can make sure that everything is indexed).

@cturner - well spotted, but the spelling mistake is in the actual folder name and in the script

Finally figured this out.

The Posix path required by ‘get record at’ is the path relative to the database root in DT, not the full MacOS Posix path. So, where I had “/Users/mark/Recipies” above, it should have been just “Recipies”, which is the folder in my DTP Inbox.

With that change, the script works correctly. For the sake of completeness, note that the synchronize method appears to return TRUE only if the index was updated, so returning FALSE doesn’t necessarily mean there’s a problem, just that nothing was updated.

That script is not longer there. I tried modifying the old script, but the old “Synchronize” command has now been replaced with ```

Update Indexed Items

@AsafKeller – are you looking to attach a script to a group that would execute and update the index whenever the group is clicked? That’s no longer possible.

If not – what are you looking to do?

Yes, that is what I was hoping to accomplish.

From v2.6 forward it should be possible to synchronize an indexed group (but not the entire hierarchy) by clicking that group name – this is the same outcome that was effected using the approach of adding a “synchronize” triggered script to the group in Show Info, and that’s why the scripted method was deprecated. To synchronize the entire hierarchy, use File > Update Indexed Items or ⌥⌘S (option-command-S).

There is a recent thread,

[url]Updating indexed groups across many databases]

which describes a script that updates all indexed groups in all open databases. Maybe that’s not what you are looking for, but it might still be interesting. Use Christian’s script, not mine.

Thanks, I was not aware of that. Interestingly, this seems to work only for newly created indexed groups, and not for ones I created with older versions of DTPO. Not a big issue; I simply recreated the groups.

And thank you @gg378 for the script!