gattu (owner)

Revisions

gist: 21311 Download_button fork
public
Description:
Ubiquity command for opening Notepad application from Firefox (on Windows only)
Public Clone URL: git://gist.github.com/21311.git
Embed All Files: show embed
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
30
31
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);
    }
})