A better way to use MobileSync with GoodReader?

I am starting to feel very stupid but again I don’t understand what you are trying. What do you mean by " a priority system, that approximates a replicant-like system"?

Do you really need topic folders within your ‘Sync DT’ folder? Why? Is it because otherwise you lack an overview of what you need to do when opening GoodReader? If so isn’t it a better solution to increase your review frequency than to use topic folders?

If I’ve understood you well DevonThink is your document organization system and GoodReader is for reading and annotating? I assume that you regularly (say once in a week) determine what to read and annotate the coming period (determining what to read is what I mean by a review)?

If so, my suggestion is to set up a ‘Sync DT’ group and folder with three subgroups/folders: High, Medium, Low (and nothing else!!!). When it is time for the review open DevonThink, determine what you want to read the next week or so and replicate everything you want to read to the priority groups within ‘Sync DT’, move them to the external folder, sync GoodReader and start reading and annotating. During the next review sync GoodReader, move the files in the priority groups into the database, delete the references of the documents you’ve read and of the documents you no longer want to read, move references that have changed in priority to the priority group where they belong now and replicate references to new documents you want to read from outside the priority group to the priority groups, when you are ready move the files in the priority group to the external folder, sync GoodReader and start reading again. And so on.

This is a simple workflow that doesn’t take too much time (it could be partly automated by means of applescripts but even without automation it is not more than 10 minutes each review).

The bottom line: if DevonThink is your document organization system you don’t need and shouldn’t want to have a copy of that organization in Goodreader, it is enough to have copies of the files you want to read this week (or today if this week’s list is too long)!

Ah, that is very easy indeed (assuming that by ‘replicant file’ you mean ‘replicant’): select the replicant and hit the delete key or click on the delete button in the toolbar

Ah, as I said, replicants within indexed groups cause problems!

GoodReader is no problem, the problem is that you have two references to the same file in an indexed group in DevonThink.

Yes you fouled up my instructions :wink: (I suggested to replicate references from outside the “Sync DT” group to the priority groups), but as you already had references to those files in the ‘Sync DT’ group, you would have had the same problem if you had followed them. :frowning:

The problem is that you can’t replicate files, you can only replicate references. So if you have two replicants (that is two references to the same file) within an indexed group (let’s say one is in the zoology group the other in the high group) you have a problem because the corresponding file can not be in both the zoology folder and the high folder.

However you can have as many replicants as you like outside the indexed group and this offers the possibility to keep your databse organized while doing your reading and annotation in GoodReader (see my previous reply).

That’s an excellent set up - and much better than the one I earlier conceived! Just out of curiosity… You mentioned that there might be a to

. What did you have in mind exactly? Also, is there a relatively easy way to create replicants while saving / importing files (so that I can quickly replicate messages into the High / Medium / Low folders that will exclusively be in the “Sync DT”)? Otherwise it seems like I’d have to saving / importing files, then navigate to them, and replicate them into the High / Medium / Low folders. Suggestions? Thanks!

I didn’t have something exactly in mind :frowning: It’s just that I have the impression from what I read on blogs and forums that DevonThink has excellent AppleScript support, so it shouldn’t be too difficult. I have no experience with applescripting DevonThink, though.

As far as I know you can’t create replicants while saving or importing. But I think there are quicker ways than navigating to the relevant references. It depends on the way in which you save/import the files. For example, if you save/import the files into an inbox you can replicate the reference to a priority group before moving them to groups in your organized hierarchy.

How about a smart group with references to all the files you added last week (or today or whatever the period between reviews)? Do not put this smart group in your ‘Sync DT’ group but use it to replicate the references to your priority groups.

I understood from previous replies that you use priority labels. There is no reason to change that (the nice thing of the suggested workflow is that you can use the existing organization to determine what should be send to GoodReader). You can add the labels in the way you add them now. Create smart groups for the relevant labels and replicate the references from these smart groups to the corresponding priority groups. (I guess this can be automated easily with an AppleScript script)

Priority tags might be easier than priority labels for these can be added when clipping.

By the way: you can’t replicate messages into folders, you can only replicate to groups. This may seem a bit pedantic. I know and I do mind. Yet, I find my reputation less important than the opportunity to clear up your mind :wink:, for I have the impression that the failure to distinguish between groups and folders and between files and references is one of the main causes of your troubles with your DevonThink / GoodReader workflow.

Just wanted to thank you very much for all of your incredible help.

I hoped that there was a way to replicate the files into the High, Medium, Low priority folders, as you suggested. But it never seems to work. So, I’m thinking about following Korm’s advice, and simply apply prefixes to items that are marked as High, Medium, Low priority.

Does anyone know…

(1) If / how to create a script that would atomically apply prefixes that corresponded to certain applied labels (High, Medium, Low priority)?

(2) If / how to create a script that would atomically remove prefixes after labels have been removed?

Thanks!

(Comment removed.)

Please, if you want help, don’t just say ‘it doesn’t work’ but add details about what went wrong.

To be sure I have now tried the setup myself and it works perfect.

I suggest that you carry out the following steps to the letter and detail any problems you encountered – if it doesn’t work, please describe exactly what you did and what happened.

Before you start, make sure that you don’t get replicants within indexed groups.

You can do this either by removing all indexed groups from your existing database before you start or by creating a new database for testing. If you do the latter: Close the old database, add a number of files to the new database, sort their references into two groups, add some replicants and label the references with the labels you normally use to indicate priorities.

Now do the following:

  1. Create a new, empty folder ‘Sync DT with GR’ on Dropbox.

  2. Index that folder from within DEVONthink (File > Index).

This gives you a group ‘Sync DT with GR’ within DevonThink.

  1. Within DevonThink: create ‘High’, ‘Medium’, and ‘Low’ groups within the new ‘Sync DT with GR’ group (don’t create anything else in this group!).

  2. In DevonThink, outside ‘Sync DT with GR’: create three smart groups, one that collects references to documents labeled ‘high’, one that collects references to documents labeled ‘medium’, one that collects references to documents labeled ‘low’. Name them ‘Label High’, ‘Label Medium’ and ‘Label Low’.

  3. Inside DEVONthink, replicate the references in the ‘Label High’ smart group to the ‘High’ group in ‘Sync DT with GR’, those in the ‘Label Medium’ smart group to the ‘Medium’ group in ‘Sync DT with GR’, those in the ‘Label Low’ smart group to the ‘Low’ group in ‘Sync DT with GR’.

Note that you should replicate the references in the smart groups, not the smart groups themselves! Do this either by means of ‘Replicate to’ in the contextual menu (you get the contextual menu by control clicking on a reference) or by dragging the references while pressing both the option and the command key.

  1. Inside DevonThink: move the document(s) in the ‘Sync DT with GR’ group to the ‘Sync DT with GR’ folder on Dropbox (don’t drag, choose ‘Move to External Folder’ in the contextual menu of the ‘Sync DT with GR’ group).

This moves the files from the DevonThink database to the Dropbox folder, their references in DevonThink remain where they are.

Your set up is ready (don’t change it!), start using it:

To read and annotate the documents in the ‘Sync DT with GR’ folder in GoodReader:

7a) Synchronize GoodReader with the ‘Sync DT with GR’ folder on Dropbox, read the documents and make annotations.

7b) Sync GoodReader with Dropbox to move the annotated files back to the ‘Sync DT with GR’ folder on Dropbox.

7c) Update DevonThink’s index from within DevonThink (File > Update Indexed Items) to incorporate the annotations in DevonThink’s index.

If this works fine try to make changes to the contents of the ‘Sync DT with GR’ groups (never rename, move, delete or trash files in the ‘Sync DT with GR’ folder on Dropbox and do not let GoodReader delete remote files):

To remove references from the ‘Sync DT with GR’ groups (without changing the organization of the database):

8a) From within DevonThink: move the relevant files into the DevonThink database by choosing ‘Move into database’ in the contextual menu of their references (don’t drag!).

This removes the files from Dropbox and puts them back in the DevonThink database. All references to these files in DevonThink remain where they are.

8b) To avoid confusion, delete the reference to those files from the ‘Sync DT with GR’ group (all other replicants remain where they are)

To add references from outside the ‘Sync DT with GR’ group to a ‘Sync DT with GR’ group:

9a) Check whether there already are replicants of those references in the ‘Sync DT with GR’ groups (if so: STOP – never add a replicant of a reference in ‘Sync DT with GR’ to ‘Sync DT with GR’!).

9b) Replicate the references from outside the ‘Sync DT with GR’ into the relevant ‘Sync DT with GR’ group (by means of ‘Replicate to’ in the contextual menu, or by dragging the references while pressing both the option and the command key). Don’t replicate a reference twice and don’t replicate replicants of references already replicated.

9c) Move the relevant documents in the ‘Sync DT with GR’ group to the ‘Sync DT with GR’ folder on Dropbox (‘Move to External Folder’ in the contextual menu).

To move references from a group in ‘Sync DT with GR’ to another group in ‘Sync DT with GR’:

  1. Move the references by dragging or by means of the contextual menu

Remember: never replicate within the ‘Sync DT with GR’ group!!!

Hope this helps!

Best wishes!

When you send a document to e.g. GoodReader this numeric file name makes it possible to identify it when you send it back to DEVONthink To Go through “Open In” mechanism. This updates the original in DEVONthink To Go without duplicating anything (except for the file in GoodReader, but there is not much that could be done here; that’s a limitation of the extreme sandboxing on iOS).

In the meantime I have experimented with scripting DevonThink and it turns out that it is indeed easy to automate the process with an applescript like this one:


-- get references to the relevant groups
set theSmartGroup to get record at "/Label High"
set theDestination to get record at "/Sync DT with GR/High"

-- get references to the content of the Smart Group
set theContent to get children of theSmartGroup

-- replicate the items in the Smart Group to the priority group
repeat with thisItem in theContent
	if not (indexed of thisItem) then replicate record thisItem to theDestination
end repeat

-- move the relevant files to the external folder
deconsolidate record theDestination

You can AppleScript replication with priority tags in this way:


-- specify the relevant database, tag and destination
set theDatabase to "Name of your database"
set theTag to "High"
set theDestination to "/Sync DT with GR/High"

tell application id "com.devon-technologies.thinkpro2"
	
	-- get the relevant references
	set theSource to lookup records with tags {theTag} in database theDatabase
	set theDestination to get record at theDestination in database theDatabase
	
	-- replicate the items in theSource to theDestination
	repeat with thisItem in theSource
		if not (indexed of thisItem) then replicate record thisItem to theDestination
	end repeat
	
	-- move the relevant files to the external folder
	deconsolidate record theDestination
	
end tell

Two clever scripts, thank you. You might want to post a full version of of your June 26 snippet for readers who are not AppleScript adepts and might want to have a complete script to work with. Also, you might want to cross post these script ideas and examples to the Script forum so they don’t get buried in this thread.

@Korm: thanks for the compliment. Good idea to post the script ideas and examples in the scripting forum. Done!

Thanks very much for this… Just out of curiosity, how would your script function different than this one (that another DTP forum member suggested)? I don’t know a thing about AppleScript code, and so I’m just curious (before I implement either of these!). Thanks!

on triggered(theRecord)
   try
      tell application id "com.devon-technologies.thinkpro2"
         
         set theSelection to the every child of theRecord
         -- set theSelection to selection
         set labelCount to 0
         -- display dialog "DEBUG at First Setting"
         repeat with thisItem in theSelection
            -- display dialog "DEBUG at Inside repeat"
            -- first we get rid of existing prefixes
            -- "1_" == I. Urgent, "2_" == II. High, "3_" == III. Moderate
            set myName to the name of thisItem
            if (the name of thisItem contains "1_") then
               set myName to my trim_line(myName, "1_", 0)
            else if (the name of thisItem contains "2_") then
               set myName to my trim_line(myName, "2_", 0)
            else if (the name of thisItem contains "3_") then
               set myName to my trim_line(myName, "3_", 0)
            end if
            
            -- next we assign new prefixes, or none, based on the current label
            -- label 1 == High, 2 == Medium, 3 == Low
            if the label of thisItem is 1 then
               set the name of thisItem to "1_" & myName
               set labelCount to labelCount + 1
            else if the label of thisItem is 2 then
               set the name of thisItem to "2_" & myName
               set labelCount to labelCount + 1
            else if the label of thisItem is 3 then
               set the name of thisItem to "3_" & myName
               set labelCount to labelCount + 1
            else
               set the name of thisItem to myName
            end if
         end repeat
         
      end tell
      set Notified to my growlMe((labelCount as string) & " items were updated by Set Prefix Depending on Label")
   end try
end triggered

-- Attribution: this "trim_line" sub-routine was provided by
-- http://www.macosxautomation.com/applescript/sbrt/sbrt-06.html

on trim_line(this_text, trim_chars, trim_indicator)
   -- 0 = beginning, 1 = end, 2 = both
   set x to the length of the trim_chars
   -- TRIM BEGINNING
   if the trim_indicator is in {0, 2} then
      repeat while this_text begins with the trim_chars
         try
            set this_text to characters (x + 1) thru -1 of this_text as string
         on error
            -- the text contains nothing but the trim characters
            return ""
         end try
      end repeat
   end if
   -- TRIM ENDING
   if the trim_indicator is in {1, 2} then
      repeat while this_text ends with the trim_chars
         try
            set this_text to characters 1 thru -(x + 1) of this_text as string
         on error
            -- the text contains nothing but the trim characters
            return ""
         end try
      end repeat
   end if
   return this_text
end trim_line

-- for information on scripting Growl see
-- http://growl.info/documentation/applescript-support.php
on growlMe(myNotification)
   tell application "System Events"
      set isRunning to (count of (every process whose bundle identifier is "com.growl.growlhelperapp"))
   end tell
   if isRunning = 1 then
      tell application id "com.growl.growlhelperapp"
         set the allNotificationsList to {"Script Status", "Failure"}
         set the enabledNotificationsList to {"Script Status", "Failure"}
         register as application "DEVONthink Script" all notifications allNotificationsList default notifications enabledNotificationsList
         notify with name "Script Status" title "DEVONthink Script Status" description myNotification application name "DEVONthink Script" with sticky
      end tell
   end if
end growlMe

The script of 7 August renames entries in a DevonThink database based on their label: it prefixes the names of entries that have the first label with “1_”, that have the second label with “2_” and that have the third label with “3_”

You asked for this on 2 June:

My snippet of 26 June indicates how to write a script that replicates the entries of a smart group to an indexed group and moves the corresponding files to the external folder. It isn’t a working script, only a sketch.

I posted a working script that replicates entries from three smart groups (‘Label High’, ‘Label Medium’ and ‘Label Low’) to the corresponding indexed groups (‘High’, ‘Medium’, ‘Low’) and moves the relevant files to their external folders in the ‘Replicating to indexed groups by means of AppleScript’ thread in the Scripting Forum.

That script can be used to automate the workflow I suggested on 31 May 2012 21:22:

and 31 May 2012 23:22:

The script performs step 3,5, and 6 in the setup of 3 June (perform step 1,2 and 4 before running the script!).

The script doesn’t replicate entries that are already in an indexed group in order to avoid troubles with replicants within indexed groups:

Working with indexed groups is a tricky business and for that reason I suggest experimenting with the workflow as described on 31 May (21:22 and 23:22) and 3 June before starting with the script!

Good luck!

Hi again,

Just wondering if there might be a new and easier way of syncing DTP with GoodReader with DTP’s new Sync function.

Any ideas or suggestions?

Thanks!

I think the sync technology only “allows you to synchronize databases”, and doesn’t sync between DEVONthink or DTTG and other apps. So, it wouldn’t improve the interaction between GoodReader and DTTG.

But, this might, if DEVONtech were interested:

goodreader.com/gr-dev.html

Ok, thanks. It seems that it’s not something that I can configure on my own, but instead depends on DTP setting it up such functionality. Lets hope they do so!

Hi,

Just wondering if anyone has figured out if there’s another way to make DTP groups & files sync with GoodReader - perhaps through using their new sync technology or through another means (i.e., through another cloud-like service). Thanks very much…