-
-
Save gattu/21311 to your computer and use it in GitHub Desktop.
Ubiquity command for opening Notepad application from Firefox (on Windows only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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