Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1 2 
Send Topic Print
Linking into DEVONThink items (Read 40007 times)
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Linking into DEVONThink items
Aug 29th, 2012, 3:31pm
 
In DT 'item' links use a form like:

x-devonthink-item://F02133F3-6520-40A6-A5B0-9CC590B8BDD6

…which if used on the Mac with both the DT  app & the relevant DT database installed will open the target DT-stored item in DT.

There is an extended syntax with allows things like

x-devonthink-item://F02133F3-6520-40A6-A5B0-9CC590B8BDD6?page=14

..which opens the target document at page #15**. This extra syntax is, I believe for PDFs only. Sadly the syntax is doesn't seem to be documented (at least anywhere one would expect)…and there's no aDTRef to fall back on!

I believe there are a couple of extra such link arguments for things like addressing individual Mail emails. If I find a reference, I'll add it here.

** somewhat unhelpfully the 'page' parameter is zero-based (ever seen a book with a page #0?). IOW, a ?page=2 parameter targets page #3 (count 0,1,2). Remember too, in figuring out the target page to use the document page not the 'printed' number in the page text as they will be different; the latter will not account for the preface, TOC, etc.
Back to top
 
« Last Edit: Aug 29th, 2012, 3:31pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #1 - Aug 29th, 2012, 3:33pm
 
This article might also be of interest.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #2 - Aug 29th, 2012, 5:48pm
 
OK, it seems there is one more PDF (only?) text file related DT link parameter you can add:

x-devonthink-item://F02133F3-6520-40A6-A5B0-9CC590B8BDD6?search=styling%20a%20link

The 'search' string will be used as a search term in the targeted PDF. In the above case the linked PDF will be opened and scrolled to the first (case-insensitive) match to the string "styling a link", with the matched text string selected. note that the string must be URL encoded, so spaces must be substituted with %20, etc. The PDF opens at the first match; find next cannot be invoked to move to a subsequent match. If the search term is not found the PDF opens at the last viewed (in DT) page or page #0 if never viewed.

Only one (or no modifier can be used). At least, I've not tried using page= and search= in one DT URL.

The DT links were new to v2 of DT and aren't as yet fully documented, and may well be added to in functionality in due course. Best place to ask for more info is the DT forums.
Back to top
 
« Last Edit: Sep 6th, 2012, 12:58pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #3 - Aug 30th, 2012, 8:12am
 
This is from the DTPro Applescript Dictionary (where few might look), the description of a record's reference URL property, i.e. an item link:

Quote:
The URL (x-devonthink-item://...) to reference/link back to a record. Append ?page= to specify the zero-based index of a page of a PDF document, ?time= to specify the time of a movie or ?search= to specify a string to search.

So the extra this shows is that one can link into a DT movie record and specify the display start point using a time-based value. Unfortunately the time format isn't described. I'd assume hh:mm:ss would be a good first try. It's seconds - see post #6 below.
Back to top
 
« Last Edit: Sep 3rd, 2012, 3:53pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Sumner Gerard
Full Member
*
Offline



Posts: 359

Re: Linking into DEVONThink items
Reply #4 - Aug 30th, 2012, 12:27pm
 
Thanks for these pointers!  Can see they will be very useful for linking to long documents in DT.

Quote:
there's no aDTRef to fall back on!

aDtRef, now that's a capital idea!
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #5 - Aug 30th, 2012, 1:05pm
 
Yes indeed, but I'm not offering!

Not least it's because I'm still at the baby steps with DT, albeit the very first thing I tried was scripting DTPro having added just two PDFs to the entire database! I did pick up a copy of the TakeControl series eBook for DT which has been useful (as has the Scrivener one), but such apps repay continued use which - as yet - my daily work doesn't need.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
John Sidi
Full Member
*
Offline



Posts: 1

Re: Linking into DEVONThink items
Reply #6 - Sep 3rd, 2012, 3:14pm
 
I played a little with the parameter "?time=" and I have found that you should write the time point in seconds. For example, the URL x-devonthink-item://DB470689-620E-4831-A428-651B08010E3D?time=80 creates a link to the 1st minute and 20th second of the movie which has this URL.
Back to top
 
 

http://www.organognosi.com - A Digital Workflow for Academic Research
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #7 - Sep 3rd, 2012, 3:54pm
 
Thanks very much for that - I've edited my earlier post to point to your correction.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Sumner Gerard
Full Member
*
Offline



Posts: 359

Re: Linking into DEVONThink items
Reply #8 - Sep 5th, 2012, 11:55am
 
Quote:
OK, it seems there is one more PDF (only?) related DT link parameter you can add:

x-devonthink-item://F02133F3-6520-40A6-A5B0-9CC590B8BDD6?search=styling%20a%20li
nk


The 'search=' parameter works not just with PDFs but with RTF and plain text documents as well!  Very useful for going immediately to the relevant location(s) of a long document in DEVONthink. If there is more than one hit, all are highlighted. Thanks for that pointer.
Back to top
 
 
  IP Logged
Sumner Gerard
Full Member
*
Offline



Posts: 359

Re: Linking into DEVONThink items
Reply #9 - Sep 5th, 2012, 11:20pm
 
Here's a script that takes selected DEVONthink RTF and plain text documents, explodes them into paragraphs, and exports an OPML file that can be opened by or dragged into Tinderbox. Each exported paragraph in the OPML file includes, among other Tinderbox attributes, a link back to the specific passage in the source DEVONthink document. This facilitates leveraging DEVONthink's strengths as a general repository for documents long and short, and Tinderbox's strengths as a tool for analyzing and discovering connections between ideas. I've worked with AppleScript only a few days. Comments/suggestions welcome.
Back to top
 
« Last Edit: Sep 6th, 2012, 11:47am by Sumner Gerard »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #10 - Sep 6th, 2012, 4:59am
 
That works nicely and creates TB attributes $DTComment, $DTTags, $OrigParaNo, $OrigURL with system attribute $URL being set to the DT link. If using this method regularly, I'd add a prototype (or a stamp) that sets some/all of these as  key attributes.

One error that does occur but which in most cases has no seeming side effect. The paragraph backlink URLs include an unintended space after the '=' character.  The error is in the paratrunc() routine. I suggest this replacement (tested):

Code:
on paratrunc(str, lgth)
	-- This function grabs a specified number of WORDS from the beginning of a paragraph (or the whole paragraph if that's shorter).
	-- The conditional in 'Explode the text…' lines in the "main" script below ensures that the string passed to this function is not empty.
	set theWords to words of str --> this tells DEVONTHINK to split str into words
	set numWords to count of theWords
	if numWords > lgth then set numWords to lgth
	set nameStr to ""
	repeat with i from 1 to numWords
		set wrd to word i of str
		if i is equal to 1 then
			set nameStr to wrd
		else
			set nameStr to nameStr & " " & wrd
		end if
	end repeat
	return nameStr
end paratrunc 



An unavoidable issue with the 'search' string link method is if the article has multiple paragraphs with the same start. I'd also consider URLEncoding the search string, e.g. a space becomes %20, etc.). AS can't do this directly but can use tolls installed in the Mac's Unix shell; here a Perl-based example.

Separately, I suspect there could be some useful AS code in this DT forum thread on highlighting and annotation.
Back to top
 
« Last Edit: Sep 6th, 2012, 5:32am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Sumner Gerard
Full Member
*
Offline



Posts: 359

Re: Linking into DEVONThink items
Reply #11 - Sep 6th, 2012, 12:11pm
 
Thanks for the pointers, Mark. I have (I think) incorporated your suggestions in this revised script.

If multiple paragraphs have the same start, DEVONthink jumps to the first one. As a workaround, if unique matches are important and numerous paragraphs start with the same 5 words (as could happen, say, in a speech), the maxSearch variable can be increased to match on more than just the first 5 words.

That DT forum thread does indeed look useful.  Thanks.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #12 - Sep 6th, 2012, 12:55pm
 
Thanks. BTW, your script let me to start tinkering with (RTF) highlight detection in DT, where I tripped over some more AppleScript weirdness which I've documented in another DT forum thread. I hope is saves a few others the time I wasted figuring out the answer.

Note to self, as there seems to be a goodly cross-over of DT & TB users, I'll try and roll some of this up into an expanded version of this aTbRef page (but probably not today!).
Back to top
 
« Last Edit: Sep 7th, 2012, 7:22am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Linking into DEVONThink items
Reply #13 - Sep 7th, 2012, 7:22am
 
OK, now see the updated aTbRef page re DEVONThink/TB use.

I'm no DT expert as I'm only a few days in as a DT user, so do let me know if there's other pertinent DT/TB info that might benefit from being added. I'd point out, that's 'missing manual' type info, not how-tos (someone else can write that!).
Back to top
 
« Last Edit: Sep 7th, 2012, 7:51am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Sumner Gerard
Full Member
*
Offline



Posts: 359

Re: Linking into DEVONThink items
Reply #14 - Sep 7th, 2012, 12:11pm
 
The first seeds of aTbDtRef!

I had trouble following the part about Quote:
copy a 'bare' link icon


Separate but related topic prompted by the mention of highlight detection up thread: should it be possible to set up an automated method to extract just the highlighted passages from selected DT document(s) and bring them and their DT internal link into Tinderbox via opml (or tab-delimited table in the clipboard)? That would be useful, playing to the strengths of both applications.
Back to top
 
« Last Edit: Sep 7th, 2012, 12:37pm by Sumner Gerard »  
  IP Logged
Pages: 1 2 
Send Topic Print