Webkit Tip

This is how to make use of webkit in applescript studio. The point is you can do anything in the view with javascript. For an example I’ll just show how to issue a Javascript command in the awake from nib handler as a proof of concept. Here’s what I do: add the web kit framework to the project, place a web view in the nib. In the applescript info panel get the view to have an on awake from nib handler. Here’s the script.


on awake from nib webView
    set |method| to "stringByEvaluatingJavaScriptFromString:"
    set |script| to "location.href='http://localhost'"
    call method |method| of webView with parameter |script|
end awake from nib

I wanted this tutorial but didn’t find it so I made it… well this is the short version anyways.