No UUID passed on to Shortcuts?

The OmniFocus action is one we created using their URL scheme :slightly_smiling_face:

I’ll give you an example:

  • create a Shortcut called TestURL

  • click the three dots next to the title

  • make the Shortcut available in the share sheet

  • have the shortcut accept all input types

  • add the action: ‘Content graph’

  • save and exit the Shortcut

  • Open DTTG

  • select a one page PDF document

  • click the share icon in DTTG

  • select the Shortcut TestURL you’ve created

You’ll see a list with one line with a PDF symbol and the title of the document in DTTG. If you click that line you’ll see a spanning tree with all content that is shared with Shortcuts and could be used, including the PDF and e.g. the jpeg included in the PDF.

Now create a bookmark to some website in DTTG, repeat the steps, but now first select the bookmark and not the one page PDF, and share the bookmark to the shortcut. You’ll now see two lines you can select: on the first you’ll a text symbol and the title of the bookmark, but the second is a URL. That URL could also be the URL-scheme of DTTG containing the UUID, but it obviously needs to be shared with a PDF and not with a bookmark.

According the Apple support page of Shortcuts the URL can be any URL, whether a web link (such as http:// ) or another scheme (such as facetime:// ). That makes me quite confident you can share the DT URL-scheme as a URL next to the content of the document itself. But I presume @cgrunenberg has most insight into that.

I know :slightly_smiling_face: We did that in the past but it confused some other apps who now picked the URL instead of the file. It’s a quite fragile system on the edges. We might try again to add the item link as a URL to non-bookmarks files and check out if it works better on current versions of iOS.

(And, actually, it’s me who’s responsible for DEVONthink To Go :wink:)

1 Like

That’s true. It might be difficult to predict what content will be used by other apps if you offer multiple.

Didn’t know that, but there you go!

@eboehnisch - Update

Just checked with DTTG version 2, and the UUID URL is passed as input to shortcuts with that version. It’s located in a text, containing a NSURL variable companying the PDF.

Could you check why the URL is passed as input in version 2, but no longer seems to be passed as input in version 3?

Do I understand correctly this feature was deliberately removed as some programs didn’t use the correct input? That seriously criples the bidirectional usability of Shortcuts and doesn’t outweigh the benefit IMO.

Yes, that is correct. Two text attachments and some apps always chose the wrong one.

As a workaround, you can use DTTG’s get-itemlink x-callback-url action to get the URL of the currently selected document. You can still set up the shortcut as a share sheet action, just ignore the input and start working with the result of the get-itemlink result…

Thanks! I’m getting close, and managed to view the UUID at least one time, but Shortcuts seems to get stuck in a loop of some sort with this method.

If you create the Shortcut above, make it available in the share sheet, select a PDF and then share it to the shortcut, what happens on your device?

Edit: this somehow disables many share sheet actions, I presume because some memory issue. If I reboot my device and try again the shortcut runs once, but only once.

Edit2: the share sheet actions seem to get disabled system wide. I needed to reboot multiple times, so I suspect there’s something going on with the x-callback routine somehow.

One thing to try would be to add a “Continue in Shortcups app” as the first action. It is part of my real-use shortcut which copies a “rich text link” to the currently selected document for use in OmniOutliner. I use this with PDFs nearly daily.

Never used that action but it’s quite nice, as it brings Shortcuts to the foreground. That did help somewhat, but it still only worked once for some reason.

There seems to be going on something beyond your solution, as the shortcut pauzes the second time I try (this time with Shorcuts in the foreground) while retrieving the UUID I think.

Does the shortcut work without any trouble for you?

@BLUEFROG or @eboehnisch could you give it a try? Perhaps it’s something with my device. You can find the action by looking for ‘x-callback’ in the action list of Shortcuts. Be aware I needed to reboot my device after trying the first time without the ‘continue in Shortcuts’ action. ‘@sven.luetkemeier’s solution uses the following string in the x-callback action:

x-devonthink://x-callback-url/get-itemlink

I just tried using my shortcut three times in a row without any issues. Here‘s a link to my full „Copy as Rich Text“ shortcut:

https://www.icloud.com/shortcuts/61fb8bc67d6e42848633adbe270d7ce2

I‘m using an iPad Pro 10.5“ which has 3 GB RAM, iPad OS 14.4 and DTTG 3.0.3.

That callback url is not working for me here.
However IIRC, URL schemes run from the Share menu are broken/problematic since iOS 14.

Thanks for checking @BLUEFROG. Good to know it’s not just me. I think the x-callback is an issue when switching apps (from DTTG to Shortcuts), but apparently @sven.luetkemeier doesn’t.have that problem. I am using an older device and Shortcut might somehow stall when memory runs low or something.

I’ve worked around for a second time and used split screen to view the shortcut on one side of my screen. I then select a record in DTTG on the other side of the screen and run the shortcut. With the callback I managed to get a UUID for any record. I’ve subsequently managed to setup a workflow to start renaming records in DTTG3 with Shortcuts by extracting the UUID from the callback.

Thanks @sven.luetkemeier! It involves some work, but I think this is usable work around while the DT staff thinks through if they can get DTTG to share the UUID together with the content. This workflow also allows me to setup complex OmniFocus tasks and insert the UUID DT URL-scheme to reference an accompanying file.

1 Like

No problem.

This shortcut is tremendously helpful. I’ve modified it to allow me to copy text in a PDF in DTTG, then update the clipboard to include that copied text (as plain text) followed (on a new line) by the rich text link of the item name (i.e., the line that your shortcut already provided).

I’m wondering, though, whether there a way to update the x-callback result so that it would return a link to the specific page from which the text is copied, rather than a link to the document?

The URL commands, among which x-callback can be found in DTTG3 under

  • Question mark (global info)
  • Help
  • Appendix
  • URL Commands

As far as I can tell the getitemlink command does not allow for parameters such as page numbers, but I only browsed the documentation quickly to check for it.

———-
Follow-up of previous comments:

I’ve tried the shortcut from the sharesheet on a newer device and can confirm it works flawlessly as @sven.luetkemeier mentioned earlier. As I expected this behavior appears to be device dependend (whether it’s memory I don’t know), but as said I can work around on an iPad by using split screen.

The link returned by get-itemlink already includes the page number, unless the first page of a pdf is displayed:

2 Likes

So it does! Thank you!

Building on Sven’s example above that fetches the currently open item details, here I extract the URL and UUID which I use to fetch the document object from DTTG.

1 Like

I’ve regexed it out. But this also works of course.

I’m still hoping DT brings back the UUID, as I seem to get this to work only with split screen, depending on the age of a device. On older devices Shortcut somehow stalls if I use the share sheet to perform the callback.

2 Likes