Intrigued by Classify not working, or I cant figure it out, I wanted to see if classification (or something like that) could be automated for bookmarks.
Obviously, I can’t use the classify
method because a bookmark doesn’t have any content. But there’s compare
, which takes a content
parameter. So, my script downloads the HTML from the bookmark’s URL, gets the raw text and passes that as content
. Example in JavaScript:
(() => {
const app = Application("DEVONthink 3");
app.selectedRecords().forEach(r => {
const params = {
record: r,
};
if (r.type() === "bookmark") {
params.content = app.getTextOf(app.downloadMarkupFrom(r.url()));
}
const targetList = app.compare(params);
})
})()
However, the targetList
is empty, although the “See also & classify” inspector shows several correct matches. That makes me wonder if the content
parameter does anything in this case? Should it?
Disclaimer & bonus question: I did try the same with AppleScript and got the same non-result. But I couldn’t make this simple line work in AS:
set html to (download markup from (url of r))
where r
refers to repeat with r in selected records
. This line gives me
„«constant Ctyphtml»“ kann nicht als „«event DTpacd36» (URL of r)“ gesetzt werden. Zugriff nicht erlaubt.
on compilation.
Well, I don’t really know AppleScript, so I probably do something bad there – but what? If I pass a literal URL string, everything works ok (kind of, the compare
result is empty, as I said).