【发布时间】:2014-04-03 04:16:23
【问题描述】:
我创建了一个 jsx 脚本,该脚本在 illustrator 中创建了一个自定义对话框,允许我将文本文件加载到字符串中。在 Extendscript 中似乎一切正常,但是当我保存它并独立运行它时Illustrator 对话框出现然后立即消失。任何想法,我都删除了所有$writeIn 声明。
我环顾四周,但似乎什么都没有 代码如下:
function init() {
dataFile=""//Load in paths to users day file and folder where spreadsheets are stored
var readFile = File(appPath+ "pathData"+".txt");
if(readFile != null) {
readFile.open('r')
dataPath=readFile.read();
readFile.close();
dataPath=dataPath.replace(/[\n\r]/g, '');//Seems to need this as without there is a cariage return added to the end of the string somewhere in the saving of the file
};
else dataPath="Press button to set path to day folder";
readFile = File(appPath+ "pathDay"+".txt");
if(readFile != null) {
readFile.open('r')
dayPath=readFile.read();
readFile.close()
dayPath=dayPath.replace(/[\n\r]/g, '');//Seems to need this as without there is a cariage return added to the end of the string somewhere in the saving of the file
//$.writeln("dayPath=",dayPath);
};
else dayPath="Press button to set path to day folder";
var initPanel=new Window("palette","iPlot", undefined);
initPanel.orientation="column"
var group1=initPanel.add("group",undefined,"GroupOne");
group1.orientation="column"
var loadButton=group1.add("button",undefined,"Load data");
loadButton.onClick = function() {
initPanel.close();
loadFile();
};
var closeButton=group1.add("button",undefined,"Close");
closeButton.onClick = function() {
//$.writeln("Close button pressed");
initPanel.close();
};
var setipButton=group1.add("button",undefined,"Setup");
setipButton.onClick = function() {
setup()
};
initPanel.center();
initPanel.show();
return true;
}
【问题讨论】:
标签: javascript adobe-illustrator extendscript