Skip to content

Instantly share code, notes, and snippets.

@gattu
Created October 31, 2008 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gattu/21311 to your computer and use it in GitHub Desktop.
Save gattu/21311 to your computer and use it in GitHub Desktop.
Ubiquity command for opening Notepad application from Firefox (on Windows only)
CmdUtils.CreateCommand({
author: { name: "Aman Bhatia", email: "amanatiitATgmail.com"},
license: "MPL",
description: _("Opens Notepad. Currently works with Windows only"),
name: ['notepad', 'notes'],
arguments: [],
execute: function(args) {
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
var path = "c:\\windows\\notepad.exe";
var args = path.split(" ");
var executable = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
executable.followLinks = true;
executable.initWithPath(path);
if (executable.exists() && executable.isExecutable()) {
process.init(executable);
args.splice(0,1);
process.run(false, args , args.length);
} else {
displayMessage(args[0] + ' is not an executable');
}
},
preview: function(pblock, args) {
s = _("Opens Windows Notepad.") + "<br>";
pblock.innerHTML = CmdUtils.renderTemplate(s);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment