在ExtendScript中从脚本GUI保存/加载用户输入?

时间:2013-07-08 00:44:54

标签: extendscript

我在ExtendScript中创建了一个非常简单的GUI,我想知道如何从我创建的“edittext”框中保存和打开任何用户输入。我如何能够添加“文件>保存”和“文件>打开”菜单来保存和检索任何用户输入?

//GUI Design
var myWin = new Window ("palette", "EditTextTest", undefined);
myWin.orientation = "row";

var groupOne = myWin.add("group", undefined, "GroupOne");
groupOne.orientation = "column";
groupOne.add("statictext", undefined, "Player 01 Name");
var etOne = groupOne.add("edittext", undefined, "");
etOne .characters = 10;
groupOne.add("statictext", undefined, "Player 02 Name");
var etTwo = groupOne.add("edittext", undefined, "");
etTwo .characters = 10;
groupOne.add("statictext", undefined, "Player 03 Name");
var etThree = groupOne.add("edittext", undefined, "");
etThree .characters = 10;
groupOne.add("statictext", undefined, "Player 04 Name");
var etFour = groupOne.add("edittext", undefined, "");
etFour .characters = 10;
groupOne.add("statictext", undefined, "Player 05 Name");
var etFive = groupOne.add("edittext", undefined, "");
etFive .characters = 10;

myWin.center();
myWin.show();

1 个答案:

答案 0 :(得分:2)

如果您正在为AE开发,可以使用以下内容在应用程序的原生首选项文件中存储和检索值:

app.settings.haveSetting("myScriptPrefCategory", "myControl");     //Check for saved pref value
app.settings.saveSetting("myScriptPrefCategory", "myControl", "controlValue");     //Saves a pref value
app.settings.getSetting("myScriptPrefCategory", "myControl");     //Retrieves a pref value

我是从David Torno那里学到的。 AE脚本论坛See this forum thread

初始化代码后,您可以查找已创建的首选项,然后设置UI以反映存储在该首选项文件中的值。