How does one load some variables at runtime in Pho

2019-08-06 13:28发布

I have about 200 folders with X images in each of them.

I have a master script in the root folder that does some stuff to the images.

Each folder has some variables specific to it and its contents.

I want my master script, when it parses folder Y, load some sort of a config file from within folder Y to get those variables, then when folder Z is to be parsed, load the config file from that one.

I know of #include "config.jsx" that I use at the moment to load it but its at the beginning of the script, I need something dynamic and doesn't need to be a jsx at all.

1条回答
姐就是有狂的资本
2楼-- · 2019-08-06 13:38

I store all my parameters in xml format and read that in using the XML objects in extendscript. As long as your parameters file is always named something like 'config.xml' it is easily located.

var file = new File( /c/folder/file.xml );       
file.open("r");
var str = file.read();
var xml = new XML(str);
查看更多
登录 后发表回答