Link to items in DT from apps that don't support x-Devonthink-item

HI
I love DT and moved to it years ago form Evernote. However, the format of the links to items has been problematic for ages for me.

Basically links to Onenote or Evernote times work from anywhere, but the DT x-devonthink-item://8C38F943-A731-44A3-A52D-0BB2B81AA5FA. the format is not recognised by a lot of apps

i use Clickup (App on my mac, not the web interface) for planning and need to be able to link to DT imtems, but cannot. (I have tried 20 management apps and of those 2 work with the DT links and i don’t want to use either of them)

Is there a way to do this? (maybe copy the link from Clickuop to the clipboard and then run a service or script with a keyboard shortcut?

Or select the link text and run the service or script with a keyboard shortcut?

many thanks

If you use PopClip you can make PopClip open DEVONthink links.

Note: This requires a visible link URL x-devonthink-item://…, it does not work with rich text links.

Welcome @Tony_S

Support for other URL schemes is added by the developers of those applications or services. I would make a feature request of whatever app you’re referring to.

Depending on what Clickup can actually link to, Hook might be a solution. Amongst other things, Hook can make a hook file which can contain any valid URI, so, e.g. an x-devonthink-item. The hook file itself resides in Finder like any other file, and is parsed through Hook to call the URI whenever it (the file) is opened. (Workflow: call Hook from DT with the document in question highlighted, select Make Hook File, select appropriate hook file from Clickup).

1 Like

This script opens selected rich text link(s).

-- Open selected rich text link(s)

-- Note: This script uses macOS's System Events.app to copy selected text so it may be that you have to increase the delay if you use it via shortcut (e.g. via Alfred or Keyboard Maestro) as there’s a chance that once in a while you don’t let your triggering shortcut go fast enough which will let macOS register your shortcut plus the shortcut System Events presses.

property theDelay : 0.2 -- see note above

try
	delay theDelay
	tell application "System Events" to tell (first process whose frontmost is true) to keystroke "c" using {command down}
	set theGrepResults to do shell script "osascript -e 'the clipboard as «class RTF »' | perl -ne 'print chr foreach unpack(\"C*\",pack(\"H*\",substr($_,11,-3)))' | egrep -o 'x-devonthink-item[^\"]*'" -- https://superuser.com/a/1409995/
on error
	display alert "No text selected or no link(s) found" buttons {"Ok"} default button 1 message "" as critical
	return
end try

set theGrepResults_list to paragraphs of theGrepResults

set theRefURLs to {}
repeat with thisGrepResult in theGrepResults_list
	set thisGrepResult to thisGrepResult as string
	if thisGrepResult starts with "x-devonthink-item:" then
		set thisRefURL to characters 1 thru 56 in thisGrepResult as string
		if thisRefURL is not in theRefURLs then
			do shell script "open " & quoted form of thisRefURL
			set end of theRefURLs to thisRefURL
		end if
	end if
end repeat

Thank you all so much!
The PopClip solution that Pete31 suggested works perfectly :slight_smile: I had never even heard of popclip but now love it :slight_smile:

1 Like

I never heard op PopClip too, it looks like a nice tool!

I do not have experience with ClickUp, but I do find it strange that you cannot use URL schemas in it. A lot of Mac Apps use URL schemas like DT has. You have solved this by using PopClip, but maybe also ask the ClickUp developers to allow a wider range of URL’s.

PopClip is one of only two apps I allow on machine boot (the other is XMenu).
It’s a great little utility and the developer is a super nice guy. :slight_smile:

4 Likes

And another great looking little tool which I would never have discovered without this forum - neat :+1:

3 Likes

Installed PopClip, really nice :slight_smile:

3 Likes

Not only

and

it’s also extremely powerful.

I first missed to carefully read PopClip’s documentation, especially the part about modifiers. Years later I stumbled across it again and couldn’t believe what this tool can do. With the great documentation and some time it’s doable to add modifiers to nearly every extension. No more avoiding valuable space for extensions that do only one action.

3 Likes

Old topic, but I found a solution with currently available software.

I already have Keyboard Maestro on my Mac. I didn’t have luck with automating a single hotkey linker, but these actions work.

I set up a KM macro, triggered in the app in question with command-U. The macro contains two actions:
copy
open URL %CurrentClipboard%

Crude, but works.

First, highlight the x-devonthink-item text. Then press command-U.

2 Likes

I have been experimenting with these solutions in Evernote 10.25.6, and have found that PopClip’s behavior is a little uneven, to say the least. And as noted, it will only work with raw X-DEVONTHINK- ITEM links, not with Evernote’s own hyperlinks (as it invariably inserts http:// before anything that is not a FILE URI).

I’m wondering - how hard would it be for DT developers to create a redirect extension for Chromium or Mozilla browsers to intercept DT’s item link URIs from Evernote or other apps, and send them back out to DT Pro 3? I’ve looked at other redirect extensions, especially Requestly – and though I’m not sure it provides a direct fix, it does allow script execution…which might get around the Electron app problems that (I’m told) are at the root of “new Evernote’s” weaker integration.

how hard would it be for DT developers to create a redirect extension for Chromium or Mozilla browsers to intercept DT’s item link URIs from Evernote or other apps

It would be likely be much easier for the other developers to “create a redirect extension” given the size of their team versus ours.

And as noted, it will only work with raw X-DEVONTHINK- ITEM links, not with Evernote’s own hyperlinks (as it invariably inserts http:// before anything that is not a FILE URI).

You can extend PopClip’s recognition of other URL types.

  1. Quit PopClip
  2. Open Terminal.app and paste defaults write com.pilotmoon.popclip OtherURLSchemes -array hook x-devonthink-item otherapp
  3. Relaunch PopClip

Thanks for the helpful advice.

I guess my broader question would be: given the key role DT plays in the PKM space, and the importance of bidirectional linking, interoperability, integration, etc…could this kind of development be considered with a higher priority? I imagine there are a number of popular apps that don’t recognize DT item link URIs. If most or all of them end up bouncing the link to the default browser, would a redirector solution not be a fairly economical way to handle them? You’d potentially get a big boost in integration (with one of DT’s most excellent features) for a relatively modest time investment.

Obviously, I’m making a lot of assumptions there - but I think it’s important to note that breakdowns in integration end up eating a lot into the time that these apps are supposed to save us. It’s not DevonThink’s fault by any stretch of the imagination – but this phenomenon does erode the user’s confidence in the ultimate functionality and compatibility of the tools.

I have never seen a DT link not usable by either Chrome or Pop-clip or Hook

Not sure why Devontech should expend effort integrating with non-standard app interfaces if they. exist

1 Like

Apologies for old thread revival.

Easy workaround for users of ClickUp: TinyURL. It’s web-based, but so is ClickUp.

I presume other URL shorteners would work or your own, depending on your security model. Plop in DT link, make your web link, drop web link into ClickUp, ClickUp can’t be fussy with your URL.

Thank you for this tip!

Here’s a visual of this macro for those who come across it later:

1 Like