1

I am using the Addon SDK and jpm.

The addon I am trying to make is for a website that gives you a specific shell command to run, but the current functionality of the website just displays the code in a text box and asks you to copy it. I thought it will be nice to create an addon that takes the text from the text box and turns it into a button which automatically executes the command.

I am having a hard time understanding how to do this. From my searches I've found out that I need to use something called nsiProcess, but it seems like I can't use this process within my content script. I can 'require' it in my main.js but I don't know how to access it in my content script file.

Is there a way of doing this?

Christos Papoulas
  • 2,469
  • 3
  • 27
  • 43
Tom A
  • 11
  • 1
  • You can not access it from your content script file. The require is only available in your main.js. Think about to use emit in order to pass the content from your content script to main.js and execute it from there. – Christos Papoulas Nov 10 '15 at 17:17
  • you need to inject content script for url's that match specific website. The pagescript on the website can send data to content script (reference: https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts/Interacting_with_page_scripts) – Nandu Nov 11 '15 at 06:57
  • I did the same thing here: https://gist.github.com/Noitidart/f605f648cab355e56648 You have to use bash, and then your commands after it. Here is a quick example: https://gist.github.com/Noitidart/f605f648cab355e56648#file-_ff-addon-snippet-bashtofile-js-L196 – Noitidart Nov 11 '15 at 21:34

0 Answers0