How to shorten a long workflow?

Fig 1.jpgI have a Group in DEVONthink Pro Office which contains RTFs of daily readings listed in groups of 3 days—1 reading is repeated 3 times a year, (see attached illustration). At the moment I open DTPO>Open the correct Database>Open the correct Group>Open the correct Day, a laborious process! It would be great if I could somehow cut this process down and I wonder if one of the great techie brains on this forum can think of a way to do this. I did wonder about emailing myself every day with the day’s reading but do not know how this could be accomplished without the hassle of adding copy/paste etc. to the above workflow! I suppose what I really need is a way to open the correct reading with a keystroke, (I do have Keyboard Maestro but only just bought it so am a complete novice). Much obliged for any ideas and help. Cheers.

In reply to myself I have found that I can create a control document in a stickies app that accepts DEVONthink “copy item links” so if I make a list with these links in the stickie app I will have a clickable index which opens up the correct reading. This is a lot better than my present set up! Any better ideas most welcome.

Here’s a little something fun…

tell application id "DNtp"
	activate
	try
		open window for record (item 1 of (search (do shell script "date +'%b *%d'") in (get record at "/Group 01" in database "+ In Arbeit") within titles)) -- A quick name search based on todays date - and this expects a fairly rigorous filenaming.
		-- Obviously you'd customize the Group and Database here.
		-- It's best to be more specific than less.
		-- And yes, it will error if the database isn't open (though you COULD code opening it too, if you had a mind to).
	on error errnum
		if (errnum = "Can’t get item 1 of {}.") then set errnum to "Can't find a file matching today's date."
		display alert "" & errnum
	end try
end tell

Save it in ~/Library/Application Support/DEVONthink Pro 2/Scripts/ (and whatever subfolder you feel like, if so). Name it as you’d like. Map a hotkey to it, etc.

Note: This except for the error trapping, this is essentially a one-liner. :smiley: Also, if it finds more than one hit. It will just open the first.

Thanks Jim, I will give it a try. Cheers.

I have now had a go at this and modified the script accordingly to open the desired day’s reading. I have also composed a Keyboard Maestro Macro so all I have to do is a single keystroke that will open DEVONthink and then open the correct daily reading. This is wonderful and a great help to me so thank you once again Jim for your script, (much better than my idea above!). :smiley: :smiley: :smiley:

My pleasure, Andrew. It was a nice little treat to whip up and hopefully an encouragement to someone interested in scripting. :smiley:

Hello,
I’ve got a message:
DEVONthink Pro got an error: Can’t get database “+ In Albeit”.
If you find this question non-trivial, I’d appreciate a reply.
Regards

It is trivial actually :smiley: as it’s a database that’s on my machine. You’d need to change this line to reflect your own group and database (as noted in the comment)…

open window for record (item 1 of (search (do shell script "date +'%b *%d'") in (get record at "/Group 01" in database "+ In Arbeit") within titles)) -- A quick name search based on todays date - and this expects a fairly rigorous filenaming.
      -- Obviously you'd customize the Group and Database here.
```Note: This script is custom written for Allsop’s scenario. You would need to have files with the month abbreviation and today’s date in the filename for it to be of any use in its current form.

Feeling awkward a bit :confused:
Thank you!

No worries and no need to feel awkward. :smiley: