Shortcuts on Monterey

Thanks I will try that

Well, there’s little point to automate an app you do not have. So I don’t see that as a disadvantage,. It’s the same as a script that requires the dictionary of a certain app: without all, no dictionary, so the script can’t run.

Why do you even need Shortcuts for that? The whole thing could be written in JXA.
In addition (again) some blatant PR: Introduction to JXA | JavaScript for Automation (JXA) has some pointers on how to use JXA with DT and other apps.

2 Likes

Because it’s a great teaching example.

First of all, check out the DT3 scripts that come with the app. There are a bunch of them. Also, have a look at the Take Control of DEVONthink book and the MacSparky Field Guide. Each has pretty extensive section on automating DEVONthink.

2 Likes

I know why I need (or rather, want) it, but I get the impression you’re not certain that a scripting solution will help you.

Personally, I pack the DT3/DTTG logic into utility-shortcuts which are called by other shortcuts. That way, I can replace DT3 with a different storage at any point without rewriting other existing shortcuts (but I do not plan to).

Here’s a sample condition that I use to run the correct utility, depending on whether the shortcut runs on the iPhone or Mac:

(get device-model / if device-model is “Mac” / Run shortcut “DT3 with JS” / Else / Run shortcut “DTTG on iPhone”)

That approach closes the compatibility gap for my use-case.
What specific scenario do you want to cover across your devices?

I do get the advantages of scripting. In fact, I advocate it over shortcuts (especially JXA). In my opinion, shortcuts is of very limited utility, and I tried to argue that point in this thread before.

After you explained your rationale, I see the point of your example. I’m not convinced that one could write an abstraction layer to isolate the underlying storage system (at least not if it’s something as complex as DT), but that’s neither here nor there). If that scratches your itch, who am I to argue. But since DT stores is documents as they are in the filesystem …

Fortunately, I do not have to cross the device gap. This thread started out with an argument about missing DT support for shortcuts, I tried to argue that shortcuts are not that great anyway and that I’d rather have good scripting support on all platforms.

1 Like

Related but somewhat off-topic…

Included in the documentation for my unofficial DT3 API and Zapier interface is an iOS shortcut which accepts an X-Devonthink UUID and downloads the document or Group to an app of your choice. I was pleasantly surprised to see that the shortcut works equally well now on macOS as on iOS

The Shortcut link is here (you need to download it with iOS; then it syncs to Monterey and works there too):

Shortcuts

Incidentally - the shortcut above is a good example of something you can do with Shortcuts that you cannot do with either Applescript or JXA. It lets you retrieve a document via an API and then send that document to any compatible application installed on either iOS or macOS.

I do not believe any way to do the same in Applescript or JXA without manually coding the scenario for each app you want to support on each platform.

More specifically- can you initiate a generic “Share” request via Applescript or JXA as you can in Shortcuts? I can’t find much about that online except this old post where it was hard to do

For sure this cannot be done on iOS without Shortcuts because you cannot use Applescript or JXA on iOS.

In Shortcuts this is pretty straightforward for either iOS or macOS

I see this “Shortcuts” as an “Automator” for advanced users, “overadvanced” for “Automator” but “underadvanced” for AppleScript (and the like). Almost everything Shortcuts can do one can do with AppleScript + Keyboard Maestro in a much more elegant way ))

As for why we don’t see a success in this direction, and to say more, will never see - is just a matter of a few simple figures: share of users who really want or rely on an inter-app automation is about 5%. 3-4 out of these 5 percents already know Apple/JavaScript, ObjC, JXA or the like. Tell me now will there be a real push for Apple (or would it be any other company) to really invest in all this just for this 1 but “overdedicated”) percent? Never. Except allowing a little playground for enthusiasts.

Oh, and DT3 is able to more than suit almost all these 5% with its own automation techniques (smart rules and folders and etc) and existing functions even if you don’t know all these AppleScripts… )

1 Like

I beg to differ. Automation is important not only for enthusiasts but also in a business environment. I worked in publishing, and a lot of the processes ran on Macs and used different kinds of automation tools from finder actions to AS running in Quarkexpress. Given that Microsoft’s office programs as well as Adobe’s software support macros respectively other scripting techniques, I believe that automation is important for a relevant clientele. Maybe not relevant for Apple, though.

Yes, you are just talking about these 4 percents
“Enthusiasts” - are those 5-4=1% :wink:
Don’t want to invest in learning automating languages - keep this “overhumanized-in-exchange-of-usefullness” tool and enjoy )

Are there any updates on that topic? Now even the Pages and keynote are supporting Shortcuts :slight_smile:

About the argument that programming with apple script or JXA is better - maybe in general yes, but not for me in this moment, after spending a day in work on manipulating Excel sheets in R or programming in Python I don’t want to spend another part of my evening or weekend on learning new language for simple piping, example workflow:

copy link to www page → DT shortcut save to indicated database → Shortcut get devonthink x-link → output Link name

I think there are many users who dont have time/energy to learn current scripting but would be happily using even rudimentary Apple Shortcut; Heh, there is even a quite substantial mac power users community who embrace shortcuts (counting by number of paid and unpaid portals posting about shortcuts, I didnt saw so many posts about users favorite Apple Scripts :slight_smile: )

There also nice tools for debugging shortcuts now
Logger Is the Missing Console for Shortcuts Power Users - MacStories

While that might be true, Shortcuts currently is a broken mess. And it also requires learning, but of an obscure under-documented product that has (as Applescript) no use outside of the Appleverse.

I agree that the idea of shortcuts is nice. Like the idea of Automator. But Apple (was “Adobe” because of auto-correction) apparently can’t be bothered to implement and maintain something really useful.

1 Like

Adobe?

Adobe was a victim of Apple’s perfect auto-correction on the iPhone’s keyboard.

2 Likes

Everything depends on the priorities of the developers :wink:
I hope the shortcuts will be soon good enough to invest developers time and support there.
I could use Applescript to run from shortcuts, so I am able to adjust my workflow if I really need it, but with default shortcuts support probably would be easier :slight_smile:

I doubt that. In order to avoid AppleScript/JavaScript, the developers would have to replicate the complete scripting dictionary in Shortcuts. And what would be the point of that?

A more convincing argument (for me) would be the (again: theoretical) portability of shortcuts across platforms. Which, again, in reality is nothing but a faint hope. I’m still not able to call a shortcut on macOS with an URL selected via the share menu. OTOH there’s no AppleScript/JavaScript support on iOS.

Shortcuts is a half-baked mess right now. And I don’t have hopes that it will get better (as in better, not as in more shiny marketing blurb) given Apple’s record.

2 Likes

I see shortcuts as a hacky API to pipe and glue and tape between different apps
Shortcuts, AppleScript, Terminal: Working around automation roadblocks – Six Colors
Maybe UNIX pipes would be more reliable​:grin: (hint; they have many rough edges too and programming in a shell is generally advised again if someone could write the same in Python for example) but in the end what matter is to get work done - and shortcuts are a bit easier to grasp than AS, even if they are harder to debug :stuck_out_tongue_winking_eye:

Offtopic - but maybe there are somewhere nice concise materials to learn enough basics of AS to manipulate windows, input and output in DT dabates ?

@pete31 posted a ton of code here. Also, looking for "tell window“ might turn up interesting stuff.

But what do you mean by “manipulate windows”?