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
Caio
this works fine for me os x 10.7, MacRuby 0.11 (ruby 1.9.2)
[universal-darwin10.0, x86_64]
#!/usr/bin/env macruby
framework 'Cocoa'
class Trash_Files
def initialize()
@error = Pointer.new(:object)
@path = "#{ENV['HOME']}/Desktop/Y-U-NO-TRASH-ME-MACRUBY.txt"
system "touch
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 noobish
On Tue, Aug 2, 2011 at 04:55, Caio Chassot wrote:
> On Tue, Aug 2, 2011 at 04:26, Terry Moore wrote:
>> Sounds like an asynchronous issue. Try adding a completion selector and
>> calling nsrunloop.
> Tried both, no dice.
Side talk for the curious:
http://tweetlibrary.com/kch/trash
_
On Tue, Aug 2, 2011 at 04:26, Terry Moore wrote:
> Sounds like an asynchronous issue. Try adding a completion selector and
> calling nsrunloop.
Tried both, no dice.
@jacknutting mostly nails it:
> core problem is that AppKit classes are really meant for use in a full app
> (w/ GUI). Foundatio
Sounds like an asynchronous issue. Try adding a completion selector and calling
nsrunloop.
Terry Moore
On 2/08/2011, at 10:56 PM, Caio Chassot wrote:
> On Tue, Aug 2, 2011 at 03:24, Caio Chassot wrote:
>> At this point I'm sure this is not a MacRuby bug, just some Cocoa
>> weirdness. I'd love
On Tue, Aug 2, 2011 at 03:24, Caio Chassot wrote:
> At this point I'm sure this is not a MacRuby bug, just some Cocoa
> weirdness. I'd love to understand exactly what the hell is going on,
> if anyone knows…
…and to back that, it fails in ObjC too, and adding a sleep there fixes it, too.
On Tue, Aug 2, 2011 at 03:01, Caio Chassot wrote:
> Weird. So maybe there's something I don't understand about NSWorkspace?
Some meh progress: adding sleep 0.1 before the puts sets things right.
At this point I'm sure this is not a MacRuby bug, just some Cocoa
weirdness. I'd love to understand e
> The equivalent code works fine in Nu.
Oh, actually I went ahead and tested again in nu, this time both
interactively under nush, and as a script with nush in the shebang
line. Interactively it works, as shebang it fails silently, same as
macruby/irb.
Weird. So maybe there's something I don't un
NSWorkspace.sharedWorkspace.recycleURLs:completionHandler: fails for
me when run via normal macruby, yet works in macirb.
Sample code:
#!/usr/bin/env macruby
framework 'Cocoa'
path = "#{ENV['HOME']}/Desktop/Y-U-NO-TRASH-ME-MACRUBY.txt"
system "touch #{path}"
url = NSURL.fileU
10 matches
Mail list logo