Hi! Any suggestions (or a script ) to how I can simultaneously capture a webpage (.webloc) and an .rtfd version from Safari (or another browser)?
Do you realize an RTFD version won’t necessarily maintain the appearance of the original page?
Yes, sir. I do.
Here’s a quick teaching edition version, creating a bookmark and rich text file in the Inbox of the current database…
tell application "Safari"
if exists (window 1) then -- Make sure a window is open
set ct to (current tab of window 1) -- Set a variable to the current tab in the current window (window 1)
set taburl to URL of ct -- Get the URL of the current tab to pass to DEVONthink
end if
end tell
tell application id "DNtp"
set newRecord to create record with {URL:taburl, type:bookmark} in incoming group of current database
-- Normally you'd set the name when creating a file. However, with a bookmark, DEVONthink should pull the title and automatically set the name
convert record newRecord to rich -- Convert the bookmark to rich text
end tell
Groovy! Thank you!
You’re welcome.
Works! Thank you! You’re a genius!
Buttering you up to ask, how can I make it so that goes .webloc > .pdf > RTFD?
I suspect that I have to change this to tell it to make a pdf:
tell application id “DNtp”
set newRecord to create record with {URL:taburl, type: bookmark } in incoming group of current database
convert record newRecord to rich – Convert the bookmark to rich text
end tell
But from there I am not sure.
Sorry to abuse your kindness. This is magic to me, though I now know how to open the Scripts Editor. Baby steps. Hope to have time to get a better grasp of this interesting tool and KBM.
No worries. I hope you’re learning something from it.
Here’s an amended version converting the PDF to rich text after it has been created…
tell application "Safari"
if exists (window 1) then -- Make sure a window is open
set ct to (current tab of window 1) -- Set a variable to the current tab in the current window (window 1)
set taburl to URL of ct -- Get the URL of the current tab to pass to DEVONthink
end if
end tell
tell application id "DNtp"
set newRecord to create record with {URL:taburl, type:bookmark} in incoming group of current database
-- Normally you'd set the name when creating a file. However, with a bookmark, DEVONthink should pull the title and automatically set the name
set pdfRecord to convert record newRecord to single page PDF document -- Convert the bookmark to a single page PDF
convert record pdfRecord to rich -- Convert the single page PDF to rich text (RTFD)
-- You could also just convert the bookmark to rich text, per my previous example.
end tell
Thanks again.
You’re welcome.