"On Import" isn't always triggered: Is the "Every minute" trigger a good substitute?

In one of my workflows I copy email messages (EMLs) via AppleScript to DEVONthink, but the move doesn’t trigger the “On Import” trigger of subsequent Smart Rules. The “Every Minute” trigger works better. Is this a good substitute – or can i use something less intrusive?

PS: Here the AppleScript which copies the EML:

try
	tell application id "DNtp"
		set theRecord to import "${tmpfile}" from "MailMate" name "${name}"
		set modification date of theRecord to creation date of theRecord
		set the URL of theRecord to "${url}" 
	        display notification "Added message \"${name}\" to DEVONthink" with title "MailMate"
	end tell
on error errMsg number eNum
	tell application "System Events"
		activate
		display alert "DEVONThink: " & eNum message errMsg
	end tell
end try

No. Too much burden. And a script never triggers an import event, afaik. You can use performSmartRule in your script, for example.

1 Like

Scripts do not automatically trigger smart rules as only the scripter knows when to trigger which event. See command perform smart rules.

1 Like

Burden on the system? Do I need to worry if DEVONthink does a few checks every minute?

Only if the actions are performed again and again.

2 Likes

Thanks. Only the check will be done every minute, the action will be done just when new stuff arrives.

But it’s not even necessary. So what is the point?

Why are you using System Events to for the display alert command? It’s part of the Standard Additions.

Also, why Every Minute versus Hourly ?

True, true. Good point. Not necessary.

However it makes things simpler for me: The triggering script is part of another app (a bundle in MailMate) and I want to avoid touching it.

Good idea! So in production I might move to hourly (there is no real urgency in execution), but for testing it helps a lot if things happen quickly.