Need help triggering a smart rule when clipping via sorter

I’m not seeing it work here when using the external script, at least not consistently.

I tried Safari just now — it worked once (!), but then never again. Weird.

I also just tried:

  • verify/optimizing the database (no luck)
  • closing all databases, and clipping into a new empty database (no luck, again)
  • reinstalling DT3 beta2 (no luck)

Well, at least it doesn’t seem to be a bug for anyone else! Must be some quirk of my setup. At least I can easily run the rule manually whenever I need it. Thanks for looking into this for me!

(Oh, I forgot to mention I am on MacOS 10.13.6, if that would have any bearing.)

Do certain URLs always fail?

No, it’s all of them. I just tried a page from my own site (that I know only has just some HTML text and a few photos), and it fails each time.

But again, it is just the “on clipping” trigger that fails. (I have a version set up to run “on quit” and it works fine.)

Please let me know if the upcoming beta 3 shouldn’t fix this - thanks!

Will do.

Just tested this using beta 3, and I am still running into this problem.

To review:
(1) I have a smart action with trigger set to “on clipping”:

(2) I then clip a webpage from either Chrome or Safari as rich text clutter free:

(3) And not all actions get performed. With this smart rule, only the “play sound” command gets run — the “mark as read” or “execute script” commands do not.

I couldn’t reproduce the script issue but at least the mark issue will be fixed by beta 4.

Fingers crossed. Maybe they are related.

Just for due diligence’s sake, I’m still not able to reproduce the issue here either.

It’s been a couple versions since I tested this last, so I wanted to give it a try again.

Quick Summary: I created a Smart Rule that runs a script which reformats the text of a record (changes font size etc). This Smart Rule works fine when I set it to perform On Demand and On Quit, but it does not work when set to On Clipping (the whole point is to clean up clipped articles).

I just confirmed that this problem is repeatable in beta 5. But here’s what’s interesting:

(1) I added a “beep” into the loop of the script to confirm it is running, and when the script executes:

  • it plays the beep
  • it does not do the text formatting

(2) However, if I add an alert at the beginning of the script, the entire script does work, text formatting and all.

I know that you could never reproduce this bug, but I thought this detail might suggest what is going on.


on performSmartRule(theRecords)
	display alert "cleaning up clipped articles..."
	tell application id "DNtp"
		repeat with theRecord in theRecords
			tell text of theRecord
				set size to 11
				set size of paragraph 1 to 10
				set size of paragraph 2 to 18
				set color of paragraph 2 to {7196, 17733, 34695}
				set (font of every attribute run whose (font contains "Bold")) to "Georgia Bold"
				set (font of every attribute run whose (font contains "Italic")) to "Georgia Italic"
				set (font of every attribute run whose (font does not contain "Bold" and font does not contain "Italic")) to "Georgia"
				set {alignment, line spacing, paragraph spacing, minimum line height, maximum line height} to {left, 4, 8, 0, 0, 0}
			end tell
		end repeat
	end tell
end performSmartRule

This is my smart rule

I commented out the display alert in your script.
I clipped a web page as rich text and got this…

Clearly modified by your code.
Here is the original clip…

I think the issue of it not triggering is happening when there is more than one file present. Add a File action to send the resulting file to another location, like /Processed.

Tried that, but alas still not working on this side.

However, I noticed the page you clipped had no graphics, so I did this test. I clipped two different articles to Rich Text with Clutter-free turned on:

  • when I clipped a webpage with no photos, it created a RTF document, and the script ran fine
  • when I clipped a webpage with a photo, it created a RTFD (“Rich Text with Attachments”) document, and the script did not edit the text

I also noticed that when the clipper creates a RTFD document, I cannot modify it manually (e.g. edit text, rename the file, or delete the file) for around 30 seconds. (No activity is being shown during this time, and no smart rules are running.) While RTF documents can be modified immediately.

no smart rules are running.

Your smart rule would be triggering at this time.

And yes, the pages I clipped had graphics and yielded RTFD files. I saw the beachballing, but the content was modified after the clip.

Use the Report Bug function, then double-click the Console.log instead of sending the email. AppleScript errors, including those in smart rules, should be reported there.

Yes, but I turned it off for that test.

Here’s what I get:

2019-08-01 10:35:43.085 DEVONthink 3[29224:1930028] INFO: Clipping <>
2019-08-01 10:35:45.844 DEVONthink 3[29224:1930028] INFO: Clipped <>
2019-08-01 10:35:45.954 DEVONthink 3[29224:1930028] WARNING: Couldn't lock file: KRecord <2363F340-8D42-4477-B8C6-8413C5082EA5> (RTFD: "Desert libraries of Chinguetti")

@cgrunenberg would have to respond on the file locking issue.

However, this is that URL clipped and run through the smart rule…

Just out of curiosity, unzip and double-click this smart rule (obviously you’ll need to adjust the target group) (1.9 KB)

Probably a timing issue, the file might be still locked by a background task of DEVONthink. I’ll check this.

Tried your rule, but getting the same results as with my rule.

And the same Console messages?