adobe illustratorのスクリプティング用にextendscriptを学んでいます.xml関連の解析を書くのはとても難しいです. 私の問題文を以下に示します。-「名前、都市、国という 3 つのテキスト ボックスを使用しました。「名前」は一意のキーです。[OK] ボタンをクリックすると、名前が存在しない場合はデータを xml に保存する必要があります。それ以外の場合は更新します。重複を作成せずに以前の名前.xml ファイル内のすべての名前がリスト ボックスに表示されます.特定の名前の日付は、リスト ボックスの選択した項目のデータを削除する削除ボタンで削除できます.私がしようとしたコードは次のとおりです: -
var myWindow = new Window ("dialog", "Form");
var txt1 = myWindow.add ("edittext");//name unique
var txt2 = myWindow.add ("edittext");//city
var txt3 = myWindow.add ("edittext");//country
var btn=myWindow.add ("button", undefined, "OK");
btn.onClick = function () {
for (i=0;i<numberofnamesinxml;i++)//coding required
{
if(txt1.text!=xmlname[i]) // to verify name not there since it is like primary key
xmlFile.open("a");
xmlFile.write(root.toXMLString());
xmlFile.copy ('C:/data.xml');
xmlFile.close();
//myList refresh
}
}
var myList = myWindow.add ("listbox");
for (i=0;i<numberofnamesinxml;i++)//coding required
{
config='C:/data.xml';
config.open("r");
data= xmlname[i] //here i need to set data to
config.close();
myList.add ("item", data);
}
var btn1=myWindow.add ("button", undefined, "remove");
btn1.onClick = function () {
myList.remove (myList1.selection[i]);
//xml data having this list name must be removed
}
myWindow.show ();
親切に私を助けてください。