Hi, I have some solutions that store some information in custom metadata. Here is a script version:
//Meta Memo Ver.0.1.0beta
//AI & ID CC CS5 and later.
idmeta ={
ns : "http://ns.chuwa.sytes.net/idcomment/1.0/",
prefix : "ID_meta:",
f : app.activeDocument,
win : function(){
if (!app.activeDocument.saved){
alert("You need to save before write memo.");
return;
}
var n = this.getLen();
var w = new Window('dialog', 'meta memo', undefined);
if (n==0){
var pn = w.add('panel',undefined,'add memo');
var tx = pn.add('edittext',[5,10,350,60],'',{multiline:true});
var b = pn.add('button',undefined,'update');
var cl = w.add('button', undefined, 'cancel', {name:'cancel'});
b.onClick = function (){
idmeta.write("memo1", tx.text);
}
}
else {
for (var i=1;i<n+1;i++){
eval("p"+ i +"= w.add('panel',undefined,'memo" + i + "');");
eval("t"+ i +"=p"+ i +".add('edittext',[5,10,350,60],'',{multiline:true});");
eval("t"+ i +".text=this.read('memo"+i+"');");
eval("bt"+ i +"= p"+ i +".add('button',undefined,'update"+i+"');");
eval("bt"+i+".onClick=function (){"
+"idmeta.write('memo" + i + "',t" + i + ".text);}");
}
pn = w.add('panel',undefined,'add memo');
tx = pn.add('edittext',[5,10,350,60],'',{multiline:true});
b = pn.add('button',undefined,'update');
b.onClick = function (){
idmeta.write("memo"+i++, tx.text);
}
var cl = w.add('button', undefined, 'Close', {name:'cancel'});
}
w.show();
},
read : function(prop){
if(xmpLib==undefined) var xmpLib = new ExternalObject('lib:AdobeXMPScript');
var xmpFile = new XMPFile(this.f.fullName.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var xmpPackets = xmpFile.getXMP();
var xmp = new XMPMeta(xmpPackets.serialize());
return xmp.getProperty(this.ns, prop).toString();
},
write : function(prop, val){ //f:fileObject, val1:String, val2:String
if(xmpLib==undefined) var xmpLib = new ExternalObject('lib:AdobeXMPScript');
var xmpFile = new XMPFile(this.f.fullName.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var xmp = xmpFile.getXMP();
var mt = new XMPMeta(xmp.serialize());
XMPMeta.registerNamespace(this.ns, this.prefix);
mt.setProperty(this.ns, prop, val);
if (xmpFile.canPutXMP(xmp)) xmpFile.putXMP(mt);
xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
},
getLen : function(){
if(xmpLib==undefined) var xmpLib = new ExternalObject('lib:AdobeXMPScript');
var xmpFile = new XMPFile(this.f.fullName.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var xmpPackets = xmpFile.getXMP();
var xmp = new XMPMeta(xmpPackets.serialize());
try{
var len = xmp.dumpObject().match(/memo\d/g);
if (len==null) return 0;
else return len.length;
}catch(e){
return 0;
}
}
}
idmeta.win();
more information and CEP Extensions are available below, But Japanese only. Please use translate service like google translate. http://chuwa.iobb.net/tech/archive/2014/02/metadata.html
... View more