Wiki Shell Scripting for MouseHole #
A wiki. That stores scripts. Run them from the URL. You have a personal Yubnub. This idea is Jake Donham’s and he dropped in on the MouseHole list a few weeks ago. My incarnation of his script is called MouseCommand.
To give you an idea of what’s possible, a few recipes du jour. For best effect in Firefox, go to about:config and set keyword.URL to http://127.0.0.1:37004/cmd/. Restart Firefox and make sure MouseHole is running and MouseCommand is installed.
del
A simple redirect to a del.icio.us tag.
location "http://del.icio.us/tag/#{args.join '+'}"
date
Display the system date and time. Arguments optionally passed into String#strftime.
if args.empty? Time.now.to_s else Time.now.strftime( args.join( ' ' ) ) end
url
For debugging. Pass another command in (try: url date or url del ruby) and get a dump of the headers and content generated by that command.
run( args.join '/' ) rescue nil
body = "<p>"
response.header.map do |k,v|
body += k + ": " + v + "<br />"
end
body + "</p><pre>#{ response.body }</pre>"
links
Make a list of links for a given URL.
body = "<ul>"
doc = read_xhtml_from "http://#{ args.join '/' }"
doc.each_element( "//a" ) do |link|
if link.attributes['href']
body += "<li>#{ link.attributes['href'] }</li>"
end
end
body + "</ul>"
If you have MouseCommand setup as keyword.URL, you can also type new shortcut to create a new command with the name shortcut. Also, list all to see your command list and edit shortcut to… you know… (Again, credit goes to Jared. A bunch of useful command ideas is elsewhere.)


Danno
This is the darkest and most powerful Voodoo yet!
IA IA RUBY FHTAGHN !
piyo
should I do
internet : privoxy : mousehole : firefox
or
internet : mousehole : privoxy : firefox?
keith23
Cool stuff! When testing it in Firefox though I noticed that the commands only execute when they are given an argument, otherwise I get a WEBrick “Service Unavailable” error. For example, just typing ‘date’ gets the error, but ‘date %d/%m/%Y’ works fine.
why
Oh and if you have the gem called
Syntax, then the code will be highlighted.keith23: yeah, firefox doesn’t really do one-word keywords. try typing in
keyword:date.robert
Uuurgh lovethis.
robert
Well that worked!
Comments are closed for this entry.