No UUID passed on to Shortcuts?

@cgrunenberg or @eboehnisch

Any idea whether the UUID can somehow be handed over to Shortcuts using the share sheet in DTTG3?

It seems there is no way to add the UUID other then first use ‘copy item link’ and paste that from the clipboard, but that requires two clicks which is somewhat annoying. When I add a task to OmniFocus from the share sheet of DTTG the UUID is transferred (to OmniFocus that is).

Without the UUID the only way to share content is to duplicate the document in another app which is likely undesirable if it could be referenced with the UUID and URL-scheme like in OmniFocus.

To what in Shortcuts should the UUID be handed to, what exactly would you like to accomplish?

What ever I need done! :grinning:

But to make it more substantial. DT is a document management program and referencing documents from other apps reduces the need to duplicate files all over your devices. But referencing a document without error requires a UUID and there appears to be no way that a UUID can be used by Shortcuts, unless it was first copied to the clipboard.

For example: if I create an OmniFocus task related to a document, I prefer to do so with a Shortcut. The reason is that GTD discipline prescribes for tasks to be ‘do-able’ and therefore contain a verb. “Invoice 123456’ is not a task, it’s a document title. ‘Pay invoice 123456 before March 1st’ is a task.

Let’s say I have a document called ‘Invoice DTTG3’ that requires payment to DevonTechnologies. I then first store that invoice in DTTG and use a shortcut called ‘Due payment’ or something alike to create an OmniFocus task that is called ‘Pay invoice ’ and substitute the with the document title.The Shortcut then asks me what the due date for the payment is and who is the recipient, and it groups it in a project called ‘due payments’. If I copied the UUID to the clipboard beforehand, the URL-scheme with the UUID is added in a similar way that the standard ‘Add to omniffocus’ share sheet action does.

The latter seems somewhat redundant and annoying, as a URL can be added to the information passed into Shortcuts. Using the ‘retrieve URL’ action would then allow for the URL to be used in the Shortcut. I use the ‘retrieve text’ action to add the text from a OCR’d PDF as well by the way, but I usually look at the original invoice in DT to be sure the information is correct.

Unfortunately, when adding data to the Share sheet DEVONthink To Go doesn’t know which app will receive the data. So it shares the actual file — at least that is what Shortcuts takes from the input and hands over to the next step. We’ll keep in mind that sharing a UUID might be useful but I’m unsure if it’s easily possible on iOS.

It appears it is possible, as the OmniFocus action uses it. That’s why it boggles me the current implementation of DTTG3 Shortcuts doesn’t use it.

And to be clear: it’s not a question of choosing between either a UUID or the content. Both are useful and I use both. Be it by manually copying the UUID first.

@BLUEFROG mention previously in a comment iOS automation is limited, which is obviously correct, but it is even more limited if available information from DTTG is not shared with 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?