OmniWeb?

Hi just upgrade my DT to Pro, and I really am very happy with the improvements made. I used DT extensively for some time, but its use had dimished quite a bit. Especially the possibility to have such AppleScript integration is great.

Right now I switch to Safari for surfingexpeditions where I want to collect the data in DT, but I much prefer OmniWeb.

As a true AppleScript nitwit, I tried and replace the term Safari by Omniwen in the supplied scripts, but unfortunately that does not work.

Could you please tell me how to make it work for OmniWeb?

Thanks!!!

I’ve just downloaded the latest OmniWeb 5.1.x beta but it’s still impossible to access the HTML source of an OmniWeb browser window. Therefore it’s not possible at the moment to modify the scripts for OmniWeb.

What a pity!

But thanks for looking in to this, anyway!

Indeed it is impossible right now, but perhaps a future update of OmniWeb will allow more scriptability: see the quoted reply from the Omni-group

You can use the following to get the HTML source of the BODY of a web page:


tell application "OmniWeb" to do script "document.body.innerHTML;" window browser 1

Another possibility is to get the URL and then download it via cURL using a shell script:


tell application "OmniWeb" to set windowURL to address of browser 1

do shell script "curl " & quoted form of windowURL


This will return the source code of the page in question. However, it will not necessarily re-create the current state of the page (if it is a results page of a form that was submitted, etc).

Version 1.0.2 will include the following scripts for OmniWeb:

Add image to DEVONthink
Add linked images to DEVONthink
Add linked images to DEVONthink’s downloads
Add links to DEVONthink
Add links to DEVONthink’s downloads
Add selection to DEVONthink

Is it yet possible to create an “add page” to DT for Omniweb?

Cheers

The last time I’ve checked this it was impossible due to limitations of OmniWeb.

The only possible workarounds are to either download the page again and store the downloaded page (does not work for form results or if the page requires a correct referrer and is of course a slowdown) or to create some “pseudo HTML” using JavaScript (doesn’t support CSS and scripts and therefore the style, sometimes even the content would be different).

Some minor modifications of Krioni’s code:


tell application "OmniWeb" to set theURL to address of browser 1 
-- Tries to handle the referrer problem and handles the text encoding
tell application "DEVONthink Pro" to set theHTML to download markup from theURL


tell application "OmniWeb"
set theHTML to do script "document.body.innerHTML;" window browser 1
-- All header information, e.g. styles, scripts, keywords etc., isn't stored
set theHTML to "<html>" & return & theHTML & return "</html>"
end

thanks Christian