Creating sheet data using x-callback-url

Anyone have an example of creating a sheet document using x-callback?

I presume it would be createDocument and the file content would be .tsv but I don’t know the UTI to use for DEVONthink To Go sheets. Of course, I could be off in my presumptions and maybe you can’t even do this…

TIA!
Lee

I know (kind of) how to create a sheet document. But I don’t understand what you’re intending to do with the x callback. Could you elaborate on that, please?

You’d use the createDocument URL command and the UTI public.comma-separated-values-text or public.tab-separated-values-text (the standard UTIs for these file types).

Thanks! That’s the magic I needed…

Could you elaborate on that? I’d love to understand the Why and How here.

I’ll explain. I am working on an iOS Shortcut to replicate some of the template features from DEVONthink 3 (DT3) in DEVONthink To Go 2 (DTTG).

First I created a new document with template (Email Accounts) in DT3.
Then I show the document in finder where I find the Email Accounts.tsv source file.
The contents look like this (the wrapping is weird in Fig…):
“Provider#string” “Website#url” “Email#url” “Type#set{values:IMAP|POP3}” “Mail Server#url” “Port#int” “SSL#bool” “Username#string” “Password#string” “SMTP Server#url” “Port#int” “SSL#bool” “Username#string” “Password#string” “Note#text”
“” “” “” “” “” “” “” “” “” “” “” “” “” “” “”
I copy/paste that into a text action then set a variable I will use to build a x-callback-url to create that document inside DTTG.

I create this url using text and variables inside Shortcuts and it will create the Email Accounts document inside DTTG in the Global Inbox. The encrypted source is the Base64 encoded version of the content above. This is used in the “Open URL with x-callback’ action in Shortcuts.

x-devonthink://x-callback-url/createDocument?destination=&title=Email%20Accounts&source=IlByb3ZpZGVyI3N0cmluZyIJIldlYnNpdGUjdXJsIgkiRW1haWwjdXJsIgkiVHlwZSNzZXR7dmFs%0D%0AdWVzOklNQVB8UE9QM30iCSJNYWlsIFNlcnZlciN1cmwiCSJQb3J0I2ludCIJIlNTTCNib29sIgki%0D%0AVXNlcm5hbWUjc3RyaW5nIgkiUGFzc3dvcmQjc3RyaW5nIgkiU01UUCBTZXJ2ZXIjdXJsIgkiUG9y%0D%0AdCNpbnQiCSJTU0wjYm9vbCIJIlVzZXJuYW1lI3N0cmluZyIJIlBhc3N3b3JkI3N0cmluZyIJIk5v%0D%0AdGUjdGV4dCIKIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiIJIiI=&uti=public.tab-separated-values-text

I will be sharing this Shortcut in this forum eventually…

I was messing about with this exact type of mechanism some time ago. However, I find Shortcuts to be cumbersome and almost impossible to debug - and the general flashing of the screen as apps are switching drives me crazy.

We are in discussion regarding some other routes, but nice find.

Well… Adding Shortcuts parameter support would stop the visual round-tripping.

Using Scriptable with Shortcuts is a little less cumbersome but then anyone else using it has to install Scriptable.

The other thing I want to build is a csv/tab importer.

Adding Shortcuts parameter support would stop the visual round-tripping.

Depending on the circumstance. But many apps don’t have specific support so it’s something you have to deal with in many cases.

Yes, it is a hodgepodge but unless you have scripting inside the app for automation your stuck navigating the minefield. Javascript seems to be all the rage these days.

As far as debug, throwback to the 80’s where printf was the debug tool…

But which apps, minus the OmniGroup ones, support scripting via JavaScript? And it’s all a proprietary solution, not a system-wide.

As for Shortcuts: That’s on the list.

All apps that support AppleScript also support JavaScript. I largely prefer the latter, but it is as badly maintained as AppleScript by Apple. JavaScript is as much as “system-wide” solution as AppleScript.

But not all methods work the same way as in AppleScript. E.g., if you get an image from a webpage in DT3 with AppleScript, you get raw image data. In JavaScript, you get some kind of ASCII stuff that’s not documented anywhere and not usable. As always, YMMV.

And AppleScript is nothing that will ever come to iOS, and neither does JavaScript (except for Omni who have written their own, proprietary JavaScript-based scripting engine). Shortcuts is the way to go on iOS, I fear.

While not from Apple, Scriptable on iOS lets you use JavaScript inside and in conjunction with Shortcuts…

Yes, the key are the Shortcuts extensions as the only accepted way on iOS to automate applications. And that’s definitely on our list.