Run script from script

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
)orgen
Posts: 34
Joined: August 28th, 2006, 4:12 am

Hi, I got a scriptfile (pScript) that I want to run from another script, how do I do that? Hope someone can help.

var pScript = new File(baseFolder+"\\"+myTree.selection.parent.parent.toString()+"\\"+myTree.selection.parent.parent.toString()+".jsx");
pScript.open(); ??

Thanks J
tapsystem
Posts: 21
Joined: February 19th, 2013, 2:44 pm

Hi,

i think you can do something like that :

var scriptFile = new File("yourScriptPath + yourScriptFileName");
scriptFile.open();
eval(scriptFile.read());
scriptFile.close();

Mr
)orgen
Posts: 34
Joined: August 28th, 2006, 4:12 am

Thanks tapsystem!

Found this script which worked well for me

var baseFolder = "Z:\\00_Grafikkmaler_Master\\Settings\\(setup)";
var lScript = new File(baseFolder+"\\"+"PromoLauncher.jsx");

var lText = "";

// Load the script's contents into a string
lScript.open("r");
while (!lScript.eof)
lText += lScript.readln() + "\r\n";
lScript.close();

// Evaluate the script's contents
eval(lText);
Post Reply