This is probably easy and/or old, but: would like to know how to write a script to automatically convert a bookmark into an Instapaperized or otherwise decluttered web page whenever the bookmark lands in a given folder. I know how to script the conversion part: it’s the automatic triggering that has me stumped.
There is no “automatic triggering” for a group in DEVONthink. Even when attaching a triggered script, it still requires you to interact with the group by clicking on it.
This is the basic idea.
on triggered(theRecord)
tell application id "DNtp"
-- Do stuff with theRecord, like…
display dialog "" & (name of theRecord)
end tell
end triggered
Okay thanks. So something like this, then?
on triggered(thisItem)
tell application "DEVONthink Pro"
set theSelection to every record in the current group whose type is bookmark
repeat with thisItem in theSelection
set thisPage to convert record thisItem to html
set theUrl to "http://www.instapaper.com/text?u=" & the URL of thisItem
set theSource to download markup from theUrl
set theTitle to get title of theSource
create record with {type:html, source:theSource, name:theTitle, URL:theUrl} in current group
delete record thisItem
end repeat
end tell
end triggered
Then just attach it to the group?
You’re reusing thisItem, which can lead to problems or confusion.
In this line…
“the current group” is theItem that’s triggered the script.
I’m kind of new to scripts, but would like to implement this too.
Can you please provide me with the full code so I create a script for it.
Thank you.