URL is not is left intentionally blank. You’ll want to change the trigger to on import (Edit: no you won’t, currently this rule will only work when triggered manually, see my post below.)
The script is as follows:
-- includes sections from C. Grunenberg: Set name to title of web page
-- those sections Copyright C. Grunenberg
on performSmartRule(theRecords)
tell application id "DNtp"
try
repeat with theRecord in theRecords
set theURL to URL of theRecord
set this_source to download markup from theURL
if this_source is not missing value then
set this_title to get title of this_source
if this_title is not missing value and this_title is not "" then set the name of theRecord to this_title
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
end performSmartRule
There is something else going on here too; @cgrunenberg: the smart rule above will not trigger automatically, even when set to on import (or on creation); the reason is that as the item arrives in the inbox, it has no URL; that is added moments after it arrives. That also means that the script fails even if the URL is not condition is removed. When I added a line display dialog theURL it will display a blank dialog - the URL is empty. Immediately after arriving - or if the rule is active, then immediately after the rule has failed with AppleEvent timed out the URL is added to the document.
Use a rule which triggers on importing name matches unnamed document. Set the action to Move the item to the inbox of another database. Print as PDF to DT from the reader view in Safari. The item will be moved to the inbox of the other database and will never receive a URL. (This is not to detract from the possibly unrelated bug the OP has reported; although I’m not convinced that is a DT problem - if I print the PDF to Acrobat, the same thing happens.)
I’m not sure whether Jim was referring to my report or yours; I fear your report is not caused by DEVONthink - if I print a PDF to Adobe Acrobat from the Safari reader view, the document is also called “unnamed document”. Saving (as per your point 2 in the original post) is different to printing to PDF (and that may be another workaround - save to a folder in Finder, index that folder in DT and set a smart rule to automatically move the file to the database).
I can now report that your hunch that this might not be a Devonthink issue might be correct. I get the same problem when saving a PDF to Evernote on both Big Sur and Catalina.
If that is correct, the ability to save Safari Reader web pages as named PDFs is important (at least to me) so we’ll see what the solution is.
Thanks for the feedback. My solution above (smart rule/script) will work manually, and apparently possibly automatically on Catalina. As far as Big Sur is concerned, I’m working on a workaround
And here you go:
In addition to my smart rule/script above, you need a second smart rule (which has to be above the first one in the list):
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
perform smart rule trigger import event record theRecord
end repeat
end tell
end performSmartRule
In combination this will automatically rename PDFs printer from Safari’s reader view. Tested, and it works here (Big Sur).
When I print a page as a PDF from Safari to Devonthink I get an “unnamed document” When I print a PDF to the desktop it is named properly. When I print a page as a PDF to Devinthink NOT in Reader mode it works with the correct name. I tested this on articles from both the Wall St Journal and my local newspaper.