Continuing the discussion from Problem: Automating "Save PDF to DEVONthink 3":
I’m trying to create a script to save all open tabs in Safari as PDFs in DEVONthink 3 Pro and not having any success. When I use the AppleScript syntax linked above:
tell application id "DNtp" to create PDF document from theURL with pagination
I get an error:
URL of item 1 of {tab 1 of window id 2393, tab 2 of window id 2393, tab 3 of window id 2393} doesn’t understand the “create PDF document from” message.
When I try what seems to be the more current recommended syntax:
tell application id "DNtp" to create record with {name:name of theTab, URL:URL of theTab, type:PDF document}
… it appears to work correctly, with the clipper launched and a PDF document created with tags, URL & metadata - except the PDF is blank and zero bytes, and DT shows a PDF icon with “no file”. This is also true for .webarchive. This script syntax only appears to work if I save as type:bookmark
Any tips? Here’s the entire script in case it’s useful:
tell application "Safari"
set theTabs to tabs of window 1
repeat with theTab in theTabs
if exists URL of theTab then tell application id "DNtp" to create record with {name:name of theTab, URL:URL of theTab, type:PDF document}
end repeat
end tell
Incidentally, this issue frequently happens for me when I clip webarchives into DTTG and then sync to DT. The webarchives import and appear properly in DTTG but then show up as “no file” and 0 bytes in DT.