Publish from Tinderbox to DEVONthink

Here is an update that is supposed to fix the linking problem in DEVONthink.

Locate the “Publish single note to DEVONthink” note (in “–UTIL–”). Replace from “var linkNotes;…};” up to, but not including $DTExportSource, with this code;

var linkNotes;
linkNotes = find($SourceURL.beginsWith(“x-devonthink-item”) & !$IsAlias);
$DTExportSource = ;
linkNotes.each(l) {
var dtLink($SourceURL(l));
var lp(exportedString(l, “^path^”));
if(theExport.contains(lp)) {
theExport = theExport.replace(lp, dtLink);
};
};

and links should work (even Zip-links).

2 Likes

Great Job Gunnar! Works for me. :slight_smile:

In addition, for those interested in a more tidy Stamp menu, I tucked these commands under a submenu called DEVON by naming the stamp with a prefix DEVON:

See here:

image

image

Tom

1 Like

Hi Gunnar,

Again, thanks so much for looking into this. I have tried to do as you suggest and have pasted the text into the script. But sadly, it doesn’t work for me. The links in DT are still not converted to DT-pattern links.

If you are getting it to work, I can’t imagine what we are doing differently.

Yours perplexed but still hopeful,

Gavin

same for me :frowning:

I don’t know if this casts any light on the mystery but this is what the link destination text I am getting looks like:

applewebdata://B14709FE-CAB7-4C8E-A6F5-B902D8721176/Content/Publish_to_DEVONthink/second_note.html

The last phrase: “Content/Publish_to_DEVONthink/second_note” is of course generated from the TB note hierarchy. The link label was “second note”

Are the curly quotes in the script likely to break this?

1 Like

Great - yes - the curly little quotes - works perfect now - thanks a lot!

Here is my TBX-file

TBX-Devon.tbx (165.2 KB)

1 Like

Ah yes, the curly quote issue ! If I only had been wearing my reading glasses I might have spotted that.

It works perfectly now for me too. Thanks to everyone who has helped out !

1 Like

This thread has shown up an unfortunate and unintended naming collision—looking at TBX v0.5.4.

In note “Publish single note to DEVONthink”, the code below declares a variable ‘linkPath’:

  var linkPath(exportedString(l, "^path^"));

In 2018 that wasn’t problematic. But in v9.0.0, a new action operator linkPath(). I’m not sure how such a name collision is handled. But, even if the doc works, I’d suggest updating the TBX to use a variable with a non-clashing name. I avoid this by prefixing all my variable names with a ‘v’ which makes variable names immediately obvious. Of course, other naming methods are equally helpful - mine’s just one such.

1 Like

One other thing to mention, I noticed the older code still uses $KeyAttributes. This has been replaced more recently by $DisplayedAttributes

Your code will need to be updated

1 Like

I feel the demo-writer’s pain. Maintaining TBX for long term use (by others) is a game of constant review. :open_mouth:

I see that there was some discussion a while ago about getting this to work with Markdown (i.e. inserting a Markdown file into DEVONthink instead of an HTML file). Is this still possible with the latest version of Tinderbox? And/or is it possible to do the same with an RTF file?

Cheers,
Martin BB.

Here is a quick and dirty attempt.
TBX-Dev-md.tbx (173.9 KB)

3 Likes

I’ve only tried it with a couple of short notes, but it seems to work. Brilliant! Thank you very much. I hope others will find it useful, too.

Cheers,
Martin BB.

Hi Martin and Gunnar,

Gunnar, thanks for updating the script (untested) to “markdown” from html. My preference too.

Quickly and as an addition,
I noticed in the quick and dirty attempt file, the old attribute $KeyAttributes is no longer used, it should be changed to the current name of $DisplayedAttributes in the 3 references noted below to

image

Tom

Tom, thanks for that. I’ll edit the code.

Cheers.

Updated the file.

TBX-Dev-md.tbx (173.9 KB)

2 Likes

I tried to insert notes in your file and run the stamp (publish all notes to DT). But nothing seems to happen. What am I doing wrong?

Hello Pat. great file, thank you.