Skip to main content
Roy Marshall
Known Participant
September 28, 2015
Question

Help needed to target jsxbin file inside HTML extension panel

  • September 28, 2015
  • 1 reply
  • 446 views

Hi

I am making small steps into putting my scripts into a native HTML Panel using Sublime Text, and the Extension Builder plugin for Sublime Text 2.

I have no problems running a built in JS file from within the panel, but when I want to target a compiles jsxbin file, I am having issues targeting it.

function createFile(){

  var parent = (File($.fileName)).parent.parent;

  //alert(File($.fileName)); //returns /tmp0000000001

  alert(parent); // returns a single slash

  alert("Script to run is " + parent + "scripts/helloWorld.jsxbin"); //returns Script to run is /scripts/helloWorld.jsxbin

  try{

  app.doScript(File(parent + "scripts/helloWorld.jsxbin"));

  }

  catch(e){

  alert(e);

  }

  }

The last catch above throws this message...

Can someone tell me if its even possible to target a script in this way?

Cheers

    This topic has been closed for replies.

    1 reply

    Roy Marshall
    Known Participant
    September 28, 2015

    Hey.

    I have done it by using the $.includePath to get the current path. I dont know if this is the way to do it, but seems to work for me, for now!

    var myPath = $.includePath;
    var myAbsolutePath = myPath.split(";")[0].split("/jsx")[0] + "/scripts/";
    alert(myAbsolutePath);

    try{
    app.doScript(File(myAbsolutePath + "/helloWorld.jsxbin"));
    }
    catch(e){
    alert(e);
    }