No UUID passed on to Shortcuts?

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.

1 Like

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.

2 Likes

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:

3 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

Sorry to restart this older thread but…
Would I be correct in assuming that because of th issues outlined above, that it is not possible to use iOS shortcuts to make a list of transclusion links from an input selection or group of Markdown files?
i.e.

  • in DTTG - select group or multiple files
  • share to Shortcut
  • Shortcut gets link for each file
  • appends links to a text file and formats them for transclusion
  • copies text file to a new DTTG file

I am guessing that’s not possible.

tx

That wasn’t possible with the share sheet either as it shared just one link at a time. But you could just select files one by one and write their details to some text file I guess.

Did you manage to setup the shortcut mentioned above with the x-callback?

I did. I changed it to use the transclusion format link and that was great but it would take too long to do a whole group of notes. I did find a script for DT that does exactly what I needed so when I have to I can jump to the laptop and bang out a transclusion of a bunch of files.

What’s the current state of this? I’ve installed and successfully run the Shortcut that @sven.luetkemeier posted, but it doesn’t quite accomplish what I want and I feel like my own tinkering isn’t making any headway on altering/debugging it.

I would like to capture text excerpts from a PDF and a link to the page where the excerpt appears - ideally in a single gesture, or at least without too much friction. I’m messing around with shortcut actions and the URL scheme and trying different methods of launching the shortcut (ie. sharing the document or sharing the text selection) with different bits on the clipboard (ie. the page link or the excerpt) but so far I can’t put the pieces together in a functional order.

1 Like

I think my use case is a bit different (and sorry to reopen an old thread…), but I have a short cut that creates a new Markdown document in DTTG by pulling some information from a Contact–and I want to grab the UUID of the newly created DTTG item so I can add it to the notes of the Contact card (basically to create a link between the contact in Contacts and the item I’ve created in DTTG.

The work around doesn’t work, because I’m creating the item in Shortcuts and there isn’t anything selected in DTTG.

I’m open to other ideas–or adding an action to get the UUID of a newly created item.

How does your shortcut look like and how do you activate it?

Currently, I am activating it from the Shortcuts app, from there I select a Contact to process.

It correctly creates the new MD item in DTTG, but then I am stuck at how to now get the UUID at which point I will have it update the selected Contact.

I’ve included a link to the Shortcut, if that is helpful.

https://www.icloud.com/shortcuts/a79319f069e94f12990711463d1889d4