Pb. in adding web archive from Camino to DTP

Hello,
I have been testing the standard Devon script to add a webarchive from Camino (1.6) into DevonThink Pro (1.5.1). The script “Add webarchive to Devonthink” is launched from the toolbar of Camino. When running the script, I get the following error message “Error in Camino: impossible to transfrom “class curl” of window 1 in type reference”. Same error with the other useful script “Add links to Devonthink”.
Note that the similar scripts written for Safari work well.

Hereunder the code of the script which fails. I suspect that the guilty statement is set this_URL to the “class curl” of window1 but do not know how to fix it.

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

tell application “Camino”
try
if not (exists window 1) then error “No window is open.”

	set this_URL to the «class curl» of window 1
	set this_title to the name of window 1
	
	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
			end timeout
		on error
			error "Download failed."
		end try
	end tell
on error error_message number error_number
	if the error_number is not -128 then display alert "Camino" message error_message as warning
end try

end tell

Technical skills are welcome :slight_smile:

Camino is finally really scriptable, here’s an updated script:


-- Add web archive from Camino to DEVONthink
-- Created by Christian Grunenberg on Nov Wed 15 2006.
-- Copyright (c) 2006-2008. All rights reserved.

tell application "Camino"
	try
		if not (exists browser window 1) then error "No browser window is open."
		
		set this_tab to current tab of browser window 1
		set this_url to the URL of this_tab
		set this_title to the title of this_tab
		
		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
				end timeout
			on error
				error "Download failed."
			end try
		end tell
	on error error_message number error_number
		if the error_number is not -128 then display alert "Camino" message error_message as warning
	end try
end tell

Great !
I just tested this new script and it works very well now. I also applied the same changes to the other script “Add link to Devonthink” which works fine as well.

Just a small concern, here below.
In DTP preferences > Import, I defined a default database folder (a kind of Inbox) to welcome the new notes or documents imported. When running the scripts from Safari, this default folder is selected correctly while it is not when running the scripts from Camino (in that case, the documents are stored in the “nomansland” of the database).
I can’t say whether this comes from the script, from Camino or from DTP. Not a big deal but, may be, you have some explanation about this behavior.

Anyway, I have much appreciated your support and your quick answer :slight_smile:.

Some day most scripts will be updated and use the “incoming group” property but for now they don’t. Just add “…in incoming group” after the “create record” statement and it should be working as expected.

Done. This works as expected. Scripting seems so easy… when you teach it.
Again, many thanks for your helpful support :wink: