Drag and Drop Web archive

Is there a way to drag a URL from Safari into DTP and drop it on a folder to creat a web archive of the page. I know about the apple scripts and such, but a drag and drop solution would make for a cleaner work flow and allow me to put the Archive in the exact spot I want it in. Thanks.

No, dragging a URL into the database will create a bookmark.

So it’s a 2-step process: save a WebArchive to the database (using the Archive bookmarklet or a script), then drag to desired location (the floating Groups panel is a convenient target).

Thanks Bill,

In that case, I’d like to make a feature request. While two steps is not unreasonable, it’s out of character for a refined app like DTP. From reading the message boards (before I made the post) it seems like quite a few users save as Web Archives and this would make life somewhat easier.

I have a temporary solution. I modified the Applescript to ask for a save location rather than saving to the top most directory in DTP each time. Similar to the print PDF to DTP script.

Thanks again.

I too would like to second the suggestion for the option/preference of dragging a link to DTP in order to create a webarchive (from any browser actually).

,Knight of Nee

I am Apple Script illiterate. Can you share your modified script?

cheers

No problem. I essential just made a Frankenstein script for some of Christian’s older Applescripts. Here is the entire script which asks for a directory to place the archive in.



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"
			activate
			set theDestination to display group selector "Destination" buttons {"Cancel", "OK"}
			
			set theArchive to create record with {name:this_title, type:html, URL:this_url} in theDestination
			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 the error_number is not -128 then
			try
				display alert "Safari" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell


Thanks so much.

using your script, I modified Christian’s FireFox web archive script and will share the code in the scripts forum.

I love the scriptability of DTP

cheers

:slight_smile:

I too would like to second the suggestion for the option/preference of dragging a link to DTP in order to create a webarchive

yes - I mostly use links, but if the page is very important or I think that it may disappear I do webarchive - how about Ctrl-Drag or Alt-Drag to get a webarchive instead of a link?

regards,
John

Regarding web archives, I remember in the past having problems loading them in DT when my Internet connection was out of order. I seem to remember that it was at heart an OS X problem and would have to wait for Leopard for a solution. Is this correct?

Yes, that’s OS X.

If you are offline and want to load WebArchives try this: turn Airport off.