Publish from Tinderbox to DEVONthink

If I don’t export all the notes at the same time, the text links (link from one note to another) do not work in DEVONthink. This is because of DEVONthink’s handling of HTML links. I don’t know how to explain it differently.

I’ll fix it on my side, anyway, since I am adding my own routine for RTF notes.

Export all the notes and twice, it should be all good.

The first export is what produces the $SourceURL. Before a note has a $SourceURL, there’s no way to replace links to that note. But once a note has a $SourceURL, when you export a note that links to it then the path-based link gets replaced with the $SourceURL as shown above.

In the version uploaded to the original post, this behavior only applies to text links. If you have agents or use ^include^ to get links then those won’t be replaced. But I have a local version that fixes this (it’s a bit slower and I’m not sure how it will scale though).

Sorry, @pat, I cannot get things to work that way.

Hrm, do you have the version that has the note Use text links between notes… and generate DEVONthink links?

I’ll upload the latest version soon, which has a fix for non-text links… but text links should work fine in the above version. So that’s strange.

If you upload the file (here, PM, or pat@patmaddox.com) then I can take a look and see what’s wrong.

@PaulWalters I updated the original post with 0.3.0 which has a fix for non-text links. It may address other link-based issues. Try it out and let me know if it works for you. And if not, I hope you’ll share your document so that I can investigate and see what’s wrong.

Version 0.3.0 always puts the exported notes into the Global Inbox. The earlier version respected the DEVONthink setting in Preferences > Import > Destination, which I always set to “Select Group” since the Global Inbox is nothing but a useless dumping ground.

Somewhere in this code the preference is getting ignored

  ^if(^value($MyString("/DT configuration"))^)^
    set theGroup to get record with UUID "^value($MyString("/DT configuration"))^"
  ^else^
    set theGroup to incoming group
  ^endif^

Okay I’ll fix that. In the mean time, if you look in Applescripts/CreateDEVONthink record there’s the create record with line that ends in in theGroup. If you delete in theGroup at the end of that line then it will use DTPO’s configuration rather than the global inbox.

1 Like

This is just awesome, @pat. Thank you for this!

As far as the super-cool-link-feature is concerned: In Devonthink I do see the links created between notes in Tinderbox. However, clicking those inter-note-links in Devonthink does not render any effect other thank giving me the system-error-honk.

Ideas?
Cheer!

hrm, might be something similar to what @PaulWalters is experiencing. I’m not sure what’s going on. Can you paste the HTML link that’s not working? Is the href getting replaced with an x-devonthink-item:// link or not?

I’ll try again to explain the HTML errors that appear in the file. First, I added a text link to the top level note “Publish to DEVONthink” in the text of the note “Links between notes become DEVONthink links”. Then I published the first note, and then I published the second note – separately.

The link that now appears in the HTML for the second note (“Links between notes become DEVONthink links”) is

<p>This is a link to <a href="../x-devonthink-item://2D3A180D-60A1-41E4-9AF9-F7F33BE5490F">
Publish to DEVONthink</a></p>

which DEVONthink interprets as a nonsensical link to a folder inside the database package – something that could never work.

I found a bug with links to/from notes inside containers, that I think is fixed but I’m currently vetting in my own usage. The HTML you shared above looks like that’s what’s happening – thanks for sharing that.

Does it work properly if you only link to/from top-level notes?

No it does not work properly.

Here’s the full link that DEVONthink interprets from the HTML (with personal info redacted).

Internote HTML links is a longstanding problem with DEVONthink, BTW.

Hrm I’m at a loss. I uploaded a video walkthrough in case it helps. Perhaps this is what you’re already doing though…

The only other thing I can think of is that perhaps it’s a version problem. I’m running DTPO 2.9.16, Tinderbox 7.3.0, on OS X 10.10.5. Other than that, maybe there’s some DEVONthink configuration difference that I’m unaware of.

2 Likes

(Another too-long-to-be-useful post. Deleted.)

This video really helped, @pat. Thank you.

May I suggest to expand the “Publish to DEVONthink”-Stamp-Code a bit in order to place the backlink – from Devonthink to Tinderbox – into each exported note; so one can quickly return to original note in Tinderbox while working with the exported notes in Devonthink.

Code could look something like this:

action($Text("/Stamps/Publish to DEVONthink")); $URL=$NoteURL

Does this make sense? At least, it works here.

Cheers!

@PaulWalters did you try following the steps in the video? You’re running into a bug that I’ve already acknowledged. The video is just a couple minutes and shows the behavior when using top-level notes.

Try this:

  1. create two top-level notes
  2. create a text link between them
  3. publish

I’m happy to look into situations where it’s not working correctly, but first I’d like to establish a baseline. I’ve outlined simple steps above. If those exact steps don’t work for you, that’s very interesting to me.

Does that mean it worked for you, @andreas?

I like that idea… though I have some concerns about implementing it. The $URL already carries over to the DEVONthink url field. I don’t want to throw it away though if it’s there… one possibility is to move $URL to DT’s comment field – that’s what the annotate script does if a record already has a URL. I’ll think about this a bit.

Jepp, @pat, worked just as advertised :slight_smile: Thanks again

1 Like

Hi, @pat, this is impressive. Am I right in thinking that the notes will always go to DEVONthink’s global inbox and there’s no easy way to change that behaviour? (And maybe there wouldn’t really be any point in changing it?) I’m slightly wary about moving notes out of the global inbox and into different locations in different databases and still expecting links to work, but assume that once the between-document x-devonthink-item links are all fixed by reapplication of the stamp there shouldn’t be any problem—and, indeed, in my limited experimentation that has indeed been the case.

0.4.0

  • NEW Add $PublishToDEVONthink attribute for explicit publish selection
  • NEW Set DEVONthink’s URL field to Tinderbox note link (forum request)
  • FIX Linking to and from notes in containers
  • FIX Link issue when publishing from aliases
  • FIX Respect DEVONthink’s import destination configuration (forum report)

Done :slight_smile: I like it

That’s correct in v0.3.0. This 0.4.0 update (linked in the original post) now respects the configuration you have set in DEVONthink’s Preferences->Import->Destination.

That’s the really cool thing about x-devonthink-item:// URLs – you can move documents between databases and the links still work. Every document has an identifier that sticks with the document. Now if you duplicate the document, it gets a new identifier, and the link points to the old one. So don’t duplicate a document and delete the old one, or else the link will break.

You don’t even need to reapply the stamp to fix the links. As long as the linked-to document has a $SourceURL beginning with x-devonthink-item:// then it will be all good.

See for yourself:

  1. download the document from the original post
  2. create a top-level note (give it the p_DEVONitem prototype), add some text, and link it to “Publish to DEVONthink”
  3. publish “Publish to DEVONthink” first, and your new note second
  4. for each one, click the $SourceURL launch button to view the record in DEVONthink
  5. move them to separate databases
  6. view your note, click the link, and you’ll be on “Publish to DEVONthink”
  7. if you use DTTG then you can sync both databases and see the same behavior…
2 Likes

Most impressive. Thanks, @pat.