Automatically Running a Script After a Web Page Loaded

If I’m not wrong, there’s no way to run a script automatically after a page loaded in DEVONthink Pro or DEVONagent Pro web browsers.

So I request this feature and…

Applescript is good but can we run Javascript directly without Applescript’s “do Javascript”?

Why I need this?

I browse hundreds of web sites everyday for reading and many of them are not designed for reading. It’s a real pain.

If we could run JS automatically after page loading, I could strip down and rearrange any web page’s DOM structure to my taste.

I can do this right now but I have to use a shortcut assigned to my Applescript. When I go through tens of web pages quickly, pressing shortcut keys every time is not effective and it’s quite repetitive.

An easier and quick approach could be this:

A setting in preferences to tell DT Pro or DA pro to launch URLs in default browser automatically when it’s double clicked. So we can do our Javascript in default browser.

Wouldn’t it be easier to use a custom style sheet (see Preferences > Web) instead? Or isn’t that sufficient?

I tried it first, not sufficient.

I don’t want to use same stylesheet for every web site. Some web sites are really a mess, some web sites are fine and sometimes, I need to extract information from mess without my eyes hurt :slight_smile: So…

If I could run javascript codes automatically after a web page loaded, I could do many things.

Currently I can run javascript inside an Applescript, trigger it using hot keys but…

  1. It’s not a joy to code javascript inside Applescript because I don’t have any editor that highlighting JS syntax written in Applescript. I have to code JS first, than copy the JS and paste it into AS, save the file again. If I need to change JS, i have to go the process all over again.

  2. If JS would run automatically, I wouldn’t need to press any keys.

Thanks for the suggestion though :slight_smile:

Oh and…

I need DOM manipulation sometimes. It’s not only using stylesheets.

PS: I use DEVONthink Pro and DEVONagent Pro consistently during my work day. I really need running some JS code after a page is loaded.

Thanks again.

Have you looked into Fake (fakeapp.com)? Fake is built to do what you want.

Thanks korm :slight_smile:

Fake is a very good app I think. In fact, I use their other app Fluid extensively and I really love it. ( http://fluidapp.com/ ) Fluid’s scripting capabilities are fine, all i need with Fluid is syntax highlighting :slight_smile:

But…

I need to run JS in DEVON’s internet browser after a web page is loaded. Since we cannot do it…

I’ve an idea today :slight_smile:

If I find a way to get all the links related to a search from DEVONagent Pro using Applescript, I’ll pass them to Safari and create an extension to browse them like we do in DEVONagent’s browser.

I already develop an extension for Safari to automatically manipulate web page DOM to my taste.