title: Mozilla Add-On Execute code on first run
body: <p>I am currently building an add on and I wanted to execute specific code on the first run. More specifically I want to click on my add on button, browse through my files and select an executable file. This browsing process should only be done on the first run as I want my button to "remember" to open this specific file after the first run.</p>
  
  <pre><code>jetpack.future.import("me");
  
  var buttons = require('sdk/ui/button/action');
  
  var button = buttons.ActionButton({
    id: "execute-jar",
    label: "Download Report",
    icon: {
      "16": "./icon-16.png",
      "32": "./icon-32.png",
      "64": "./icon-64.png"
    },
    onClick: handleClick
  });
  
  jetpack.me.onFirstRun(function(){    jetpack.notifications.show("Oh boy, I'm installed!");});
  
  function handleClick(state) {   
  
      let {Cc, Ci} = require('chrome');
      var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
      file.initWithPath("C:\\Users\\QaziWa\\DownloadReportPPE.jar");
  
      if(file.exists()){
          file.reveal();
          file.launch();
      }
      else {
          console.log('Failed.');
      }
  }
  </code></pre>
  
  <p>I found this on MDN: <a href="https://developer.mozilla.org/en-US/docs/Archive/Mozilla/Jetpack/Meta/Me" rel="nofollow">https://developer.mozilla.org/en-US/docs/Archive/Mozilla/Jetpack/Meta/Me</a></p>
  
  <p>However, this is something that was archived and when I tried this my code didn't succeed and got: "Message: ReferenceError: jetpack is not defined".</p>
  
  <p>I'm pretty stumped at this point as I have looked at the few questions I could find that were relevant to what I want but I cannot figure out how to implement this much needed feature in my add-on. Could someone point me in the right direction or provide an example of some code that works?</p>
  
  <p>EDIT: For clarity: I do not want to hardcode a path. I intend to add functionality that will allow users to select the file they wish to execute. My main question is how do I execute a certain block of code only on the first run?</p>