Skip to main content
Leilang
Inspiring
January 31, 2019
Question

Wrong syntax again

  • January 31, 2019
  • 1 reply
  • 2462 views

Hello, this time I have a problem with replacing the path to the file with var.

i get path from my main.js

var csInterface = new CSInterface(); 

var extensionRoot = csInterface.getSystemPath(SystemPath.EXTENSION) + "/jsx/custom.jsx"; 

csInterface.evalScript("selectedPath('" + extensionRoot + "')");

In hostscript.jsx :

function selectedPath(extensionRoot) { 

pathOK = extensionRoot;

alert(pathOK);

}

alert

= C:/Program Files (x86)/Common Files/Adobe/CEP/extensions/PREPRESS_2019/jsx/custom.jsx

And this hostscript.jsx work:

function selectedPath(extensionRoot) { 

pathOK = extensionRoot;

alert(pathOK);

}

#include 'C:/Program Files (x86)/Common Files/Adobe/CEP/extensions/PREPRESS_2019/jsx/custom.jsx'

and this one does not:

function selectedPath(extensionRoot) { 

pathOK = extensionRoot;

alert(pathOK);

}

#include pathOK;

How to change it to work ?

This topic has been closed for replies.

1 reply

Legend
January 31, 2019

$.evalFile(pathOK);

Leilang
LeilangAuthor
Inspiring
January 31, 2019

$.evalFile(pathOK);

Unfortunately, it does not work too.

Legend
January 31, 2019

What does alert(pathOK) show?


Did you assign  pathOK some value before the line $.evalFile(pathOK) ?

pathOK must be a File, not a string with a path.

Try

$.evalFile(new File(pathOK));

UPD. if pathOK is a string also try

eval("#include " + pathOK.toSource().replace(/^\(new String\(/, "").replace(/\)$/, ""));