如何在运行时在Photoshop Script中加载某些变量? [英] How does one load some variables at runtime in Photoshop Script?

查看:181
本文介绍了如何在运行时在Photoshop Script中加载某些变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我大约有200个文件夹,每个文件夹中都有X张图像.

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.

我希望我的主脚本在解析文件夹Y时,从文件夹Y内加载某种配置文件以获取这些变量,然后在解析文件夹Z时从该文件夹中加载配置文件.

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.

我知道我现在正在使用#include"config.jsx"来加载它,但是在脚本开始时,我需要动态的东西,根本不需要是jsx.

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.

推荐答案

我以xml格式存储我的所有参数,并在extendscript中使用XML对象来读取该参数.只要您的参数文件始终被命名为"config.xml"之类的文件,就可以轻松找到它.

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);

这篇关于如何在运行时在Photoshop Script中加载某些变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆