Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

perigrin (3495)

perigrin
  {chris} {at} {prather.org}
http://chris.prather.org/
AOL IM: marceusx (Add Buddy, Send Message)

After Middle School Chris bounced through various high schools around the state of Florida for a bit. He ended up getting a BA (in English) from the University of Central Florida at about the time others his age were getting their MAs. His (now) wife, their child, and he went to Europe for a bit (there was a programming job in Scotland) and came back unemployed where upon he got offered a job in St. Paul. He moved on from that job after a few years to one where he was paid to do the things he previously did as a hobby. That sounds much more exciting than it really was. Really his life is based on two kids, two cats, and a bunny.

Journal of perigrin (3495)

Thursday August 28, 2008
10:38 PM

More Ubiquity

[ #37300 ]

So I’ve been playing with ubiquity some more. Because all of the code runs in chrome:// space in firefox, you get to run as a first class citizen on the computer. Unfortunately this means if you want to do anything fun you need to deal with XPCOM.

Tonight I stole some code from developer.mozilla.org and came up with the following (only works/tested on a Mac):


function system(cmd, args) { // create an nsILocalFile for the executable
        var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile);
        file.initWithPath(cmd); // create an nsIProcess
        var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess);
        process.init(file); // Run the process. // If first param is true, calling thread will be blocked until // called process terminates. // Second and third params are used to pass command-line arguments // to the process.
        process.run(false, args, args.length);
}

CmdUtils.CreateCommand({
    name: "say",
    takes: {"your shout": noun_arb_text},
    preview: function( pblock, theShout ) {
        pblock.innerHTML = "Will echo: " + theShout.text;
    },
    execute: function( theShout ) {
                system('/usr/bin/say', [theShout.text]);
    },
})

This will run text-to-speech on whatever test you input (either via typing or that is selected in the browser) by using the say command on OSX. The important part though is not what it does, it is what it can do. This opens up all of CPAN to Ubiquity.

I think I’m gonna have some fun now.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Rock on! Thanks :)

    Now the last thing to do is make it so I can highlight text outside of firefox and use ubiquity on it. In the mac world I suppose you'd say I need to allow silverlight to talk to firefox... but I'm not in the mac world.

    Let's see.... there is that telnet-into-firefox thingie to start with. Probably a lot of other ways to do this too. hmm...