My scripts stopped working?

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.

SCRIPT BELOW

– Add web archive from Safari to DEVONthink
– Created by Christian Grunenberg on Wed Mar 15 2006.
– Copyright © 2006-2008. All rights reserved.

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

end tell

I get the same errors.

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

In addition, has been anything logged to the system console?

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.

The HTML version above works just fine. The error for me occurs only with rtf:


tell application "DEVONthink Pro"
	create record with {name:"Testing", type:rtf}
end tell

This fails. Nothing in Console, nothing changed in DevonThink Pro.

Also rebuilt LaunchServices database (via Co cktail TE), still no luck.

My problem was fixed. I had been ignoring a database error identified upon startup, but when I restored the backup, the scripts worked again.

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.

A bit more playing around, and I got things working. Apparently now “type:rtf” REQUIRES the “rich text:” property to also be set!

This, now, works:


tell application "DEVONthink Pro"
	create record with {name:"Testing", type:rtf, rich text:""}
end tell

It would be nice if changes to the AppleScript dictionary were published in the release notes!