How do I prevent TB to fetch the contents of PDFs when dragging 'n dropping from Devonthink


(Rene Trappel) #1

Hi everyone,

I’m still fairly new to Tinderbox, so my apologies if there is an very obvious answer for my question - but I could not find one in the forum (or anywhere else):

When I drag 'n drop a pdf from Devonthink to TB, how do I prevent Tinderbox to fetch the contents of said pdf stored in Devonthink? I just want TB to create a note with the name of the file and the devonthink-URL stored in $URL.

Thanks a lot!


Turning off auto fetch when dragging from DEVONthink
(eastgate) #2

You could have the container’s $OnAdd action set the text to “”.

Or you could do the same thing with an agent.

Or, you could have the container’s $OnAdd action move $URL to a user attribute $DevonThinkURL while clearing $URL itself, thus preventing Tinderbox from importing the text.

Or you could just delete the text.


(Rene Trappel) #3

Thanks for the quick reply. Somehow setting $Text to “” does not seem to work for me. I’ll add a screenshot so you get an idea what I’ve been trying. This is a very weird feature (standard behaviour), would not expect many people to benefit from it.


(eastgate) #4

The DEVONthink text is loaded later (at agent update time), so you’d need to erase the text after it’s imported.


(Rene Trappel) #5

Thanks for the reply. This sounds bit cumbersome - imagine having to delete text in twenty articles. I’m sorry to bug you again but isn’t there any way to do this automatically? This is such a weird feature. Right now I’m equally amazed by all customisation TB allows for and confused by all the (felt) complexity necessary to do the easy stuff.


(James Fallows) #6

I don’t know the exact way you’re setting up the file, but chores like this are exactly what Agents are designed to do. So you just have to figure out the way to specify which items you’d like an agent to work on. For instance you could:

  • Figure out some step that will happen after the items have been imported from Devon Think, so that whatever step adds material to their $Text field has already happened;

  • Set up an agent to run on items you’d like to change, with an agent action of $Text="" (which zeroes out the $Text field – or, $Text=; which sets it back to its default value.) That will handle the “erasing” of text.

  • Depending on the particulars of your data base, you could figure out which items you want the agent to act on in varying ways. For instance, you could have an agent that searched for (a) notes with a particular prototype, or inside a particular container, or containing a certain phrase, or created at a certain date–or anything else that would identify what you’re looking for; and (b) notes whose $Text field is not empty – ie, ones that had some imported text. (The query might read $Text!="" – one of the TB experts can correct me if that’s wrong.) Then the agent would have found the items you want to change – and would change them.

Main point is: this should be an easy-to-automate step, once you figure out a way to search for / isolate the items you’d like it to work on.


(Rene Trappel) #7

Thanks for the suggestion, this set me on the right path. I found a solution with two prototypes and an agent. After the import from DevonThink a specific prototype is attached to the note. The first agent is looking for notes with this prototype, deletes their content and attaches the other prototype. Done.

Btw if you happen to be “the” James Fallows of the Atlantic/China fame: I’m a huge fan of your work and you’re praise for Tinderbox has been one of my main reasons to try it out.


(James Fallows) #8

Glad that helped!

Yes, I am the same one – look forward to seeing you in China (or in England, where I’ll move this summer), and hope TB helps in your work.


(Paul Walters) #9

The agent idea is good.

To amplify what Mark B suggested – there is no reason that the DEVONthink x-devonthink-item has to be kept in the built-in $URL attribute. It can be kept in any URL-type attribute. So if you define a URL-type attribute $dtURL (or whatever) and your $OnAdd action on a container, or an agent, does the following

$dtURL=$URL;$URL="";

then you’ve flipped the link back to your database into an attribute that Tinderbox will not fetch. You still have the ability to one-click your way back to DEVONthink, but you’ve terminated the fetching feature.


Another option is not to drag things from DEVONthink to Tinderbox, but to use one of the numerous built-in or user contributed scripts in DEVONthink to export the metadata (including x-devonthink-item link) to CSV or OPML and export / import a block of notes that way. Visit DEVONthink’s forum to browse the history – a lot of work has been done in the export / import area.


(Mitch) #10

Dear all, as a complete newbie on TBX (in fact still waiting for my order to be processed, perhaps it was not the smartest move to place it today :slight_smile: ) I have a workflow where I archieve all my links for presentations as pdf&text in Devonthink.

I created a note as prototype, with an action
$Text="";

I have the impression this works sometimes. In fact it works when drag/drop single items from devonthink and afterwards the text-field is empty.

If I drag more than one (in this testcase 6 items, 1 formatted text, 5 pdf&text with sizes between 1,2KB and 1.7MB) make Tinderbox unusable by showing the beach ball for minutes and again on every click on one of the notes.

Ok, this is a MacBook (Retina, 12-inch, Early 2016 1,1 GHz Intel Core m3) for travelling, but clearly the workflow doesn’t work. If I understand the solution given above correctly the idea is to let TBX import the stuff and afterwards delete it with an agent. If what I did is somehow correct that doesn’t even work for a test-sized amount of data, I can not imagine what the result shall be with some serious stuff.

Could someone please help me understanding better where my error is, because Rene seems to be satisfied, so obviously there is a working solution.

Best regards
Mitch


(Paul Walters) #11

It’s not completely clear what you are looking to achieve. I assume (probably incorrectly) that you want to create Tinderbox notes that link to the original document in DEVONthink without importing the contents?

Respecting Rene’s suggestion, there is a way without a lot fuss, the simplest way IMO: Copy the item link of the DEVONthink record (Edit > Copy Item Link) then use Paste in an Outline or Map in Tinderbox to create a note whose URL is the link back to the DEVONthink item. This method gets you the Tinderbox note you want, and no contents are imported.


(Rene Trappel) #12

Since then I’ve come around using a stamp when dragging & dropping a single pdf from DT to TBX (I also use this stamp when applying the method outlined by @PaulWalters above).

I have not found a solution to speed up the import of multiple pdfs (eg to prevent the fetching). Unfortunately, the idea with an $OnAdd action such as:

$dtURL=$URL; $URL=;

did not work for me. It seems that as soon as you add a file to TBX the big fetching starts. My main machine is a mid-2013 MBA 11", so I definitely feel your pain.


(Mitch) #13

Copying the item link and pasting that works like a charm, but unfortunately that solution doesn‘t scale. If you have to do that for hunderds of items it becomes boring pretty fast. Devonthink doesn‘t offer the option IMHO to copy links to more than one item simultaniously. And dragging/dropping more than one item results in notes where the textfield contains the pdf—source—code.


(Mitch) #14

in addition every usage of one of those notes with the pdf—content in the textfield makes the pc unasable again for quite some time. The beachball of death being my best buddy…


(Paul Walters) #15

Then use this script. See


(Rene Trappel) #16

Thanks, this is really helpful!


(James Vornov) #17

It would be nice if on the Devonthink side they allowed copying multiple links at a time. I use the on one at a time method to create summary notes that reference documents. Since I’ve been using TBX for many years, I’m very reluctant to embed any media files into the TBX file.

The easy way to do it is to select multiple DTP items and then use the contextual menu “Create Table of Contents”.
That creates a new note with clickable links. That note can be dragged into a TBX note providing links back to the documents, but as links with the names of files, not the plain URL links. Nicer for some uses.


(Rene Trappel) #18

You really should give the above script a try, works great for me.


(Paul Walters) #19

Yes

After creating the TOC document in DEVONthink, which is an RTF, I suggest selecting all of its text and changing the List style to “none” so that the contents no longer is indicated with “1.”, “2.”, etc., Then copy and paste the TOC into a Tinderbox note. Afterward, you can explode the note to get a new note for every TOC entry and use a stamp to set $URL=$Text. Note: this stamp will not work. I’ll post one that does, later.

If you do not need a lot of notes, then it also works to select a URL in a Tinderbox note and drag the URL into the Outline, which creates a new note with $URL linking back to DEVONthink.


(Mitch) #20

Hi Paul, thanks for that great piece of code, works like a charm.

In addition, James proposal with “Create table of contents” is a nice shortcut if only the links are needed.

Thanks a lot to all of you, great support here for newbies :slight_smile: