Page 1 of 1

Run script from script

Posted: February 13th, 2013, 4:06 am
by )orgen
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

Re: Run script from script

Posted: March 2nd, 2013, 4:11 pm
by tapsystem
Hi,

i think you can do something like that :

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

Mr

Re: Run script from script

Posted: March 22nd, 2013, 3:59 am
by )orgen
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);