Devonthink Pro Office - Indexing Files Sync

Thank you. I’ve saved the script under User-Library-Script and assigned path within DTP group folder.
Still only syncing 1 way though (iMac to DTP). Tried changing “theRecord” for the folder name but made no difference so a bit stuck now.

Screen Shot 2014-06-03 at 13.53.57.png

Does it need to be in a specific Script folder like User, Computer, etc for it to work?

  1. The script can be anywhere on your Mac, even on the desktop.

  2. You do not want to change anything in the script. However, to make it compatible with a future version of DEVONthink, you might want to make this change to the ‘tell application id’ line:

on triggered(theRecord)
	try
		tell application id "DNtp"
			deconsolidate record theRecord
		end tell
	end try
end triggered

This change has nothing to do with what you are encountering now-the script will work fine as originally posted.

  1. The images that you posted indicate that there is not a script attached to the group in DEVONthink. A group with an attached, triggered, script will have a script icon displayed.

In case my earlier description was not clear, the script is attached to the indexed group within DEVONthink’s Select button, not through the Path field.

HTH

Top folder with script.png

All folder with Script.png

Error.png

Hi Greg, Aforementioned is what I have now. What seems to happen is I can add new groups within DTP and these are synced to iMac folder. Transferring groups to groups does not sync to iMac for me and produces the Error attachment for some reason?

Example new items sync.png

Sorry, could not attach this to previous message.

I’m not sure what would cause that-can you reproduce this behavior? Were all the sub groups created in DEVONthink, or were some created in the Finder?

As a suggestion I would try not attaching the script to sub-folders of groups where a parent group has the script attached. Meaning, if you attach the script to group 0, all the sub-groups will sync when the script for group 0 is triggered. In the past I’ve attached the script to multiple levels as you have done without problems, but the script does take some time to execute so they can slow you down if the script is acting on groups with hundreds of documents. Also, when transferring groups, I personally make sure that any indexed groups are moved into the database before nesting as a sub group of another indexed group.

Screen Shot 2014-06-03 at 15.37.39.png

Managed to reproduce the error this time with script only at level 0 (parent folder level).

Created this as a test database, generated initial folders 0-5 within Finder and indexed. Also tried by generating Groups within DTP and error reproduces.

If its woking at your end it must/could be some thing local to my iMac but I don’t know what it could be. The script works for new folders generated in DTP and generates a folder to iMac documents. Another error occurs when I move any of these Finder folders which generates a duplicate within DTP, see folder / Group 5 below showing 2 Group 5 folders (Finder on left is should be correct structure);

Screen Shot 2014-06-03 at 15.50.02.png

Beyond me

That is to be expected. You cannot move folders in the Finder that are indexed in the database without problems as DEVONthink cannot (yet) find them to reconnect. This is a know limitation that many of us have requested be changed, for some time now. Here is one thread on this that was posted just yesterday link. One thing that you can do to overcome this in most situations is to move the indexed folder into the database, move it inside another indexed group in the database, and then when the script is triggered the group will be exported back out as an indexed folder in the Finder, in its new location. More trouble than should be necessary to deal with this, but it does work.

Does the triggered sync script work as expected if you do not move any folders in the Finder?

I seem to have the opposite where moving Finder folders works but moving DTP with the script does not;

Finder - generate folders 1-5
DTP - Indexing folders 1-5 = ok
Finder - rearrange folders 2-5
DTP - collapse & expand database = no shadow files (if thats what they are called) and DTP files align with Finder folders 1-5
Finder - add files into folders 1-5
Finder - move folders 1-5 and files individually
DTP - collapse & expand database
DTP files align with Finder folders 1-5 :smiley:

Check if sync file error reproduces when file generated in DTP rather than Finder
DTP - generate folder 6
Finder - move folders 1-6 and files individually
DTP - collapse & expand database
DTP files align with Finder folders 1-6 :smiley:

Assign Script to DTP folder 1-6 and check movement errors
Finder - move folders 1-6 and files individually
DTP (Note :bulb: ) = Scripts removed from DTP automatically = possible cause of problem :question:
DTP - collapse & expand database
DTP files align with Finder folders 1-6 :smiley:

Reassign lost Scripts to DTP folder 1-6 and check movement errors
DTP - move folders 1-6 individually
DTP (Note :bulb: ) = Scripts remain in place
DTP - collapse & expand database
DTP files do not align with Finder folders 1-6 :frowning:

Current summary
Indexing DTP with Finder folder and moving Finder folders below level 1 external of DTP works for me = DTP and Finder Folder & File alignment.
I would prefer to work within DTP but probably best I avoid moving folders and files within DTP until I get the script working properly. Tested editing sample documents through the DTP interface and using Preview as external editor and these edits/changes replicated ok.

The script is very basic, as it does only one thing. When triggered, if the indexed group has internal records (documents and/or sub-folders), export them to the indexed group’s folder in the filesystem (Finder)*. There really isn’t anything to debug/troubleshoot to get working properly, and I’ve never seen DEVONthink remove any attached script from a group. I also used a more complicated version of this script (included sync and deconsolidate commands) for a very long time on all my databases. I only stopped using it when the sync command was incorporated into DEVONthink. See the pinned topic at the top of this forum here. I have to believe that there is something else creating a problem here, but I’m at a loss as to what to suggest you try.

*From the DEVONthink script dictionary:

deconsolidate v : Move an internal/imported record (and its children) to the enclosing external folder in the filesystem. Creation/Modification dates, Spotlight comments and OpenMeta tags are immediately updated.
deconsolidate
record record : The record to deconsolidate.
→ boolean

Hi Greg,

I’ve had another go and still getting the same problem so going to park it for another day. Nothing lost though as I’ve learnt a little about implementing a script which I had not done before :slight_smile:

Do you know if there is a script for syncing tags with finder files that have been indexed so if I work either within DTP or Finder and add tags they sync between both locations :question: I think this is only a problem when indexing rather than fully imported local DTP databases.

My experience is, that on Mavericks, nothing is required to keep the tags in sync beyond selecting the indexed groups which updates the tags/documents in the index. It used to be (perhaps still is the case) that DEVONthink did not write out OpenMeta tags to the filesystem unless the document was moved into the database, then moved back to the external folder. However, with Mavericks tags a change in tags from DEVONthink is immediately reflected in Maverick’s Finder tags.

If you want to update all indexed items across all databases at once with a script, there is one available from DEVONthink. Select the menu Help>Support Assistant, then from the pop-up window Download extras>Update Indexed Items. The script will be installed in the Data folder under the DEVONthink scripts menu (between Window and Help).

By default, this script only updates indexed documents or groups located at the top level of the database. See this version of the same script that will prompt you whether you want to update indexes at all levels of the database.

Thanks for that. I’m not at the iMac but will check when I get back. It may have been an old document I read about tag sync issues when indexing so happy days if it works for Maverics. Groups / file structure is there and I’m looking into tagging so want to reduce any potential problems. Once it’s all taged I will look into syncing tags from iMac to Windows PC, probably through a cloud although I’m not sure if additional software is needed for this or if they sync ok.

Got round to checking and tags are being synced fine so thats good :slight_smile:

I’m having the same problem with this script which suggests I’ve either implemented it wrong or there is something else on my iMac causing the problem but I cannot think what because everything is pretty standard.

To check I’ve done this correct this is what I’ve tried:
Install scripts external of DTP
Attached script to DTP groups/folders (high level and all combinations tried)
Not combined any off the scripts and only installed / ran them individually

I take it this should work but for some reason I’m going around in circles with this :cry:

Because this may be something local on my machine I want to check the application ID is correct and I’ve not amended it in the past somehow. How do I check ```

com.devon-technologies.thinkpro2

.

Thanks I’ve just changed it to that but still no luck. How do I navigate to find that application ID on my iMac?

I’ve also saved the script as follows and attach it here:

Screen Shot 2014-06-11 at 12.56.50.png

Is this right / wrong?

I’ve successfully used Greg Jones’ script but found that it does not quite fit my desired workflow. Perhaps somebody can suggest a tweak to solve my problem.

I have a directory full of research papers, populated by another application (BibDesk) which maintains records linking to the PDFs. I have this set up as an indexed directory in DTPO. In the rare event that I get a new paper that needs OCR, I run the OCR in DTPO. My wish is for this newly created OCR version to replace the existing non-OCR version. Instead, what I am currently getting with this script is the following:

  1. OCR conversion completes.
  2. The non-OCR indexed file is moved to the DTPO trash but not the OS X trash.
  3. When I select the folder, Greg’s script runs automatically.
  4. Upon deconsolidating, DTPO discovers that the file already exists in the linked directory and so it saves the OCR version with a “-1” appended to the filename.
  5. BibDesk is thus not linked to the new OCR file.

Can somebody please suggest a change to my workflow or an addition to this script to achieve my desired result? I think it used to work this way for me but then I upgraded OS X and now I don’t recall how/if I solved this problem last time.

Not super elegant, but I tested it out and it works. For my purposes it looks like this will work for now. Thanks!