AppleScript Mail Filing to Specific (Encrypted) Database

Sorry, my day off, so trying to get everything done in one fell swoop.

Set up some inbox rules and Mail Act-on rules to file specific email messages. Using the included AppleScript. Works well, but now trying to have it save emails in a specific database, rather than the global inbox.

Can’t figure out what I’m doing wrong, if anyone can help, here’s the relevant part of the script:

-- POSIX path of destination database. Global inbox is used if not specified.
property pDatabasePath : "/Users/robertallred/Databases/Shared Files Encrypted.sparseimage"

-- This string is used when the message subject is empty
property pNoSubjectString : "(no subject)"

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		-- Location of destination groups.
		-- set pMessageLocation to "/" & (name of theRule)
		set pMessageLocation to "/Saved Emails"
		set pAttachmentLocation to pMessageLocation & "/Attachments"
		
		tell application id "DNtp"
			if pDatabasePath is "" then
				set destination_database to inbox
			else
				set destination_database to open database pDatabasePath -- Ensure that the database is open

And now it’s working…so yes, that is the correct format for a specific group in a specific encrypted database.

property pDatabasePath : "/Users/robertallred/Databases/Shared Files Encrypted.sparseimage"

This is the path of the opened database (otherwise the extension is .dtSparse) and does not work if the database is currently closed.

Thank you–that was where I wondered if I had messed up.

Also, DT created the encrypted database with the .sparseimage instead of the .dtsparse suffix. Do I need to be concerned about that?

Also, DT created the encrypted database with the .sparseimage instead of the .dtsparse suffix. Do I need to be concerned about that?

DEVONthink doesn’t create an encrypted database as a .sparseimage. It is created as a .dtSparse file but the extension dynamically changes to .sparseimage when the database is open to avoid a potential bug with Apple’s Time Machine.

Ahhh! Thanks for the clarification.

You’re welcome.