public
gattu / x
Last active

  • Download Gist
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
CmdUtils.CreateCommand({
author: { name: "Aman", email: "amanatiitATgmail.com"},
license: "GPL",
description: _("Opens MS Paint. Currently works with Windows only"),
name: ['paint'],
arguments: [],
execute: function(args) {
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
var path = "c:\\windows\\system32\\mspaint.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 MS Paint.") + "<br>";
pblock.innerHTML = CmdUtils.renderTemplate(s);
}
})

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.