I have scripts to move sites from Safari and NetNewsWire to Devonthink (and then import web archives into Devonthink) and they’ve stopped working. With the below script, which I think I downloaded off this site, and which used to work fine, I now get the following on the event log:
create record with {name:“Google”, type:html, URL:“http://www.google.com”} missing value
download web archive from “www.google.com” referrer missing value
What’s going on with the missing values, and why can’t I do this anymore.
tell application “Safari”
try
if not (exists document 1) then error “No document is open.”
set this_URL to the URL of document 1
set this_title to the name of document 1
try
set this_referrer to do JavaScript "document.referrer" in window 1
if length of this_referrer is 0 then error
on error
set this_referrer to missing value
end try
tell application "DEVONthink Pro"
set theArchive to create record with {name:this_title, type:html, URL:this_URL}
try
with timeout of 60 seconds
set data of theArchive to download web archive from this_URL referrer this_referrer
end timeout
on error msg
error "Download failed."
end try
end tell
on error error_message number error_number
if error_number is not -128 then display alert "Safari" message error_message as warning
end try
It seems the “create record with” applescript function no longer works! The record is not created, and it returns nil. This is new as of the latest maintenance release of DevonThink Pro.
This is absolutely vital to my workflow. Is there a work around out there? Will a fix be coming ASAP?
The scripts are working fine here. Does reinstalling them make a difference? Which version of Mac OS X do you use? And does this tiny script create anything on your machine?
tell application "DEVONthink Pro"
create record with {name:"Google", type:html, URL:"http://www.google.com"}
end tell
What you may also try to do: clean your LaunchServices database using a cache cleaning tool. I have seen some sudden AppleScript oddities disappear after doing that.
Nope, no database errors when I start up DevonThink. Nothing shows up on the screen, and nothing shows up in the Console. Also tried using the “Rebuild Database” command: still no luck. Seems creating a new rtf record just plain doesn’t work any more.