DT3 No Automator actions?

I’m experimenting with DT3 - and it’s great. But there are no DT actions in Automator.

Do they need to be installed manually? If yes, where from?

Note: Automator is set to allow third party actions.

Automator isn’t supported anymore as the former actions were rarely used (and not very useful). Smart rules or AppleScript might be a good alternative (or AppleScript inside Automator workflows). What exactly do you try to accomplish?

I am missing this as well.

I would us Hazel to watch a folder. When a file appeared in the folder that matched the criteria it would change the title to the format that I wanted then would call an Automator script that would “Set Current Group” and “Add Items to Current Group” thus importing the file to the desired group of the desired database.

If this functionality is not returning, are there other ways to accomplish this?

Thanks for the help.

You could use a Folder Action (DEVONthink provides a few already) and modify it to suit your needs. You could also use the Folder Action as is, and use smart rules in DEVONthink to move files around.

Check out the built-in Help > Automation chapter.

  1. I want to watch a Dropbox folder (say ‘DevonWatch’).
  2. If a new folder appears inside DevonWatch then I want the contents of that new folder (likely a mixture of .txt .html and .pdf files) to be automatically uploaded to a single new note in a specified DEVONthink database
  3. The PDF files should be OCR’d on the way. If there are images, then they should be converted to PDF and OCR’d
  4. The new note should get the same name as the new dropbox folder
  5. The new dropbox folder should then be deleted.

I can use Hazel to some of this, but not all of it. My AppleScript isn’t good enough for the rest.

And what part of this process have you already accomplished?

PS: There is no singular note format in DEVONthink. You need to be specific about these things.

I can do step 1 directly in Hazel. Steps 2, 3 & 4 will need (I assume) a DT3 AppleScript which can be called from Hazel. Hazel can then do Step 5.

Re: note type. It should be a formatted note or an RTF. Can you advise which would be more suitable for this use case?

btw, what I’m trying to accomplish is a way of forwarding emails (inc email content and attachments) to a specified DT3 database, without being tied down to mail.app. (I personally use Spark)

I already have a ‘step 0’ set up. I can forward emails to a Zapier email address. Zapier then extracts the email content and attachments, and uploads them into into a new dropbox folder inside the ‘DevonWatch’ folder. The new folder is automatically named (by Zapier) as the email subject header.

Steps 1 - 5 (listed above) will then import the contents of the new folder into a new DT3 note.

Step 2 is not a trivial thing to do.

Also, if you have emails with the attachments, why aren’t you just importing those?

Re: step 2. What are your suggestions?

  • Is it do-able in AppleScript?
  • would you suggest RTF or formatted note?

I think the DT Evernote importer accomplishes something similar. How does that work?

Re: why not just import the email attachments. Two main reasons:

  1. I need a workflow which will work quickly from mobile too. This workflow will enable me to forward emails from Spark on iOS to the Zapier email address, and then Hazel + AppleScript will do all the rest the next time I open my MacBook.

  2. I want the workflow to be a fast single step process, not a slow multi-step process. I currently forward emails to Evernote very frequently. I need to replicate this functionality in order to transition from Evernote to DT.

There are at least two possibilities:

  1. Replace the former DEVONthink Automator actions in the workflow with one AppleScript action

  2. Index the folder and use a smart rule in DEVONthink (in many cases this makes AppleScript, Automator and Hazel obsolete).

These options could also be combined - e.g. the workflow adds the file to the global inbox, then smart rules perform additional actions like filing/classifying.

Here is an AppleScript that I used in my Hazel workflow (embedded script) to add an item to a specified DT3 folder. In this case it was the Inbox for one of my databases. This was based on another AppleScript I found in the forums.

set databaseOpen to true
set DB to "NAMEOFDATABASE"
set theDBPath to POSIX path of (do shell script "echo ~/Documents/Devonthink/NAMEOFDATABASE") -- get the full path to the database
set dest to "/Inbox" -- set the target group for storing the file

tell application id "DNtp"
	
	if DB is not in (name of databases) then
		set databaseOpen to false
		open database theDBPath -- open the database if it is not already open
	end if
	
	set destinationGroup to get record at dest in database DB
	set newRecord to (import theFile to destinationGroup)
	--set tags of newRecord to {"jim"}
	-- Commented out as I am going to let Hazel take care of it
	--if (exists newRecord) then tell application "Finder" to delete theFile 
        --I have hazel put the file into the trash thus it is commented out
	
	if not databaseOpen then
		close database DB
	end if
end tell

I am trying to modify this script to work for me: I have a folder in the Global Inbox called “OCR In”. Any pdf placed here will be handled by a smart rule which will apply OCR and then move the resulting file(s). I am terrible ignorant regarding scripting, but am starting to learn. I can get the file to the Inbox but not to the folder I want…

set databaseOpen to true
set DB to “Inbox”
set theDBPath to POSIX path of (do shell script "echo ~/Library/Application Support/DEVONthink 3/Inbox
) – get the full path to the database
set dest to “/OCR In” – set the target group for storing the file
tell application id “DNtp”

if DB is not in (name of databases) then
	set databaseOpen to false
	open database theDBPath -- open the database if it is not already open
end if

set destinationGroup to get record at dest in database DB
set newRecord to (import theFile to destinationGroup)
--set tags of newRecord to {"jim"}
-- Commented out as I am going to let Hazel take care of it
--if (exists newRecord) then tell application "Finder" to delete theFile 
--I have hazel put the file into the trash thus it is commented out

if not databaseOpen then
	close database DB
end if

end tell

I really like scripting, but it would seem totally unnecessary to me here. If you are using Hazel anyway, why not get Hazel to mark the file (e.g. add a colour label) and then move the file to Inbox? Adapt your smart rule to react to any file in the Inbox marked with the colour label (e.g. if you use a red colour Finder label, the record will be tagged “Red” in DT) and you’ve finished.

Other than that, seeing as the Global Inbox can’t be closed, I don’t see how the if DB is not routine is helpful. But then I’m missing the point of the if not databaseOpen routine too, as that would seem to attempt to close a closed database. But perhaps I’m just bleary eyed this morning. At a first glance I’m not sure why the script isn’t directing the file to the requisite folder, but as I said, a script just isn’t necessary here anyway.

2 Likes

Simple is good!

1 Like

Sometimes I think it is :slight_smile: Would you please report back if all works as intended - or not, so one of us can provide more/other/better assistance?

Your solution(s) are working splendidly!

1 Like