[MacRuby-devel] Small WebView commandline script

Matt Aimonetti mattaimonetti at gmail.com
Tue Aug 2 16:17:21 PDT 2011


1)
NSApplication.sharedApplication.activationPolicy =
NSApplicationActivationPolicyRegular
NSApplication.sharedApplication.activateIgnoringOtherApps(true)

That will give your CLI app focus.

2) No idea, the inspector is just html + js, so you should be able to port
it. You can also use the webkit scripting bridge to get Ruby <=> JS and
create a simple editor in MacRuby. (I have a demo somewhere where I show how
to write a HTML 5 game controlled by a bluetooth PS3 controller. It shows
how to easily use the webkit bridge.

- Matt



On Tue, Aug 2, 2011 at 1:58 PM, Andrew O'Brien <obrien.andrew at gmail.com>wrote:

> I've been doing some HTML scraping with Mechanize recently and I figured I
> could use a small tool that opens up a small WebView and reads HTML
> fragments from STDIN. Here's what I came up with:
>
>  https://gist.github.com/1121174
>
> There are a couple of things wrong with it that I chalk up to noobishness
> (and the fact that I usually start with an application template in XCode and
> use Objective-C), that I could use some help on:
>
> 1) Despite passing in Closable and Resizeable, the window doesn't seem to
> do either. Also I can never get focus or scroll. Does the window need to be
> open in a different thread? Have a window controller? If so, what's the best
> way to do that? (Most of the tutorials I've seen are either full
> Applications or minimal scripts with no UI.)
> 2) Is there anyway to embed/access a web developer console like the one in
> Safari?
>
> Thanks.
>
> --
> –Andrew O'Brien
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110802/a09ef3ec/attachment.html>


More information about the MacRuby-devel mailing list