DTTG shortcut - open random file from vault or folder?

There are some shortcuts to save files into DTTG. But they are not so many to access files in the DTTG.

I would like to have a shortcut that will open a random file from the folder or vault I will point to.

Does anyone have any ideas on how to implement that?

This is really good for discoverability - I have a database with many pdf, with choosing randomly I have more chance to re-discover pdfs I saved long ago, also I don’t need to decide what I will be reading today

EDIT: Solved!

1 Like

With “.pdf” I am still getting saved html opened, how I can get condition that only specific extension wil open?

Try using the search prefix kind:pdf.

1 Like

Thanks!
For those interested, with Data Jar I am able to open the latest opened file too (I store the name of the file, then I could use another shortcut to open it if I want)

You’re welcome :slight_smile:

1 Like

I was about to start a new thread to query my own shortcut but this one is very close so I’m going to hijack it instead, I hope that’s ok. (In fact it’s quite possible this thread was inspiration for my own script, I can’t remember where I got the idea.)

I decided to change my shortcut slightly, but my change has not worked. I no longer want to restrict “kind” to pdf, as I have too many markdown files that deserve to be surfaced too. My change is not quite working properly.

The shortcut runs, but it’s opening a random group, not an item.

Is that because I set “kind” to “any” so “groups” count? If that’s the case, do I need to set something like “kind is not group”?

Or is it perhaps because my files are indexed and not downloaded? So the shortcut can’t actually open a file? (Although the pdf script worked before so I’m not sure it’s that?)

kind:any doesn’t currently work as any document as it does in DEVONthink.

Hi Jim, sorry, I don’t understand your reply. I don’t really know how these scripts work. In the DT manual it says the search “Kind” supports “any”, so is this the bit I got wrong?

I actually see now that it allows “kind:group” so I assume I need to exclude this?

In the DT manual it says the search “Kind” supports “any”

Where are you seeing this?

Ahh well I’ve now realised I made a mistake because I’m looking in the DT manual, not DTTG. But anyway it’s on p229, in the wrong manual…

“Kind:any” is not a search function in the DTTG manual. :expressionless: It would really help if I read the correct manual when experimenting with things I don’t understand…

1 Like

Haha! No worries. :relaxed:

Hello. The latest iOS update (3.7.3) seems to have broken this Apple shortcut. Or at least, the shortcut has stopped in the 24 hours since I downloaded the update and I assume the two are related. I can’t see how to change the shortcut to fix the issue, nor can I see what in the release notes might have caused the issue (though obviously I have no idea what I’m doing and it might be obvious to someone else!).

The shortcut is designed to search within a defined group in a DT database and then open DTTG on a random file.

After the latest update, the shortcut is instead opening a list of files (in the shortcut menu, not DT) and asking me which to open. The list isn’t in the defined scope, I.e. they’re not files in a specific group in a specific database, they’re across all databases synced to this device. I’ve not quite worked out what it’s a list of, but I think it might be files that have been recently imported to DTTG via this device.

I have three shortcuts that do similar actions and none of them are working correctly.

Any idea on what to do?

(It’s interesting that Shortcuts is presenting a list unprompted, because normally I have to argue with it to make it do that for other apps, and usually there is an action in the Shortcut that specifically says to show or let the user choose from a list. This shortcut doesn’t have that action but Shortcuts is showing a list anyway :thinking:)

Hmm, from your screenshot it was a matter for the Catholic Church that your shortcut worked at all :wink: It probably worked by ignoring the filter, mainly due to a bug in previous versions that we fixed in 3.7.3.

Searching for kind: in the way you use it in your shortcut wouldn’t use the filter at all because there is no kind named any. You can filter for, e.g., pdf or group or just any UTI but, currently, not for documents. We’d need to introduce document as an option.

Version 3.7.4 will allow kind:any or, as synonym, kind:document to filter for only documents as well as use kind:tag to search explicitly for tags.

1 Like

Your reply cracked me up :rofl: As with many Apple things, if it’s working it’s best not to ask why :grimacing:

I’ve studied the shortcut some more and it’s specifically the first action, the search, that isn’t working. Even changing the kind and the group doesn’t do anything (nor does deleting this action and creating a new one, which I did just in case). The search scope doesn’t seem to be actioned by the shortcut (though I get no error message).

I figured I’d try a way round that and use the “get items of group” action instead to see if that helps. Turns out it doesn’t, and I get this error message:

IMG_4980

This group is indexed. I tried it with another group that is imported and it works fine, so the issue specifically seems to be with an indexed group?

Yes, it might be broken in 3.7.3 but should work in 3.7.4 (already in the works). As for an indexed group: That should make no difference at all as, actually, DEVONthink To Go does not have indexed groups at all. Maybe it’s a fairly large group with many items and the connection times out or the extension uses too much memory when accessing it (just a few theories)?

they’re not files in a specific group in a specific database, they’re across all databases synced to this device.

Are you truly intending to do such a broad search??

And this shortcut is viewing a randomly chosen item in my Global Inbox in the latest internal build…

Yes, this particular shortcut is a random quote generator from a group of quotes (it has 300 md files in it currently).

I have an even bigger shortcut that is a random file generator for an entire database though :grimacing: (That shortcut is now working again.)

So I will wait for 3.7.4
For me, a similar shortcut, instead of giving one random pdf, ask to pick a file from my inboxes :frowning:
Or has a problem with communication with the app when I try to use my orginal version

That might be a different problem. Please share your shortcut (screenshot), best to our support. Thank you.