You could try using the built-in XMP metadata. I was playing around with it in an old script to store data in the project without resorting to using text layer hacks and it worked fine.
Two functions - one for writing the data:
function setMetadata(data) {
var proj = app.project;
if(ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var metaData = new XMPMeta(proj.xmpPacket);
var schemaNS = XMPMeta.getNamespaceURI("MyNamespace");
if(schemaNS == "" || schemaNS == undefined) {
schemaNS = XMPMeta.registerNamespace("MyNamespace", "MyNamespace");
}
try {
metaData.setProperty(schemaNS, "MyNamespace:compInQuestion", data.compID); // Assume these variables are pre-set
metaData.setProperty(schemaNS, "MyNamespace:layerIndex", data.layerIndex);
metaData.setProperty(schemaNS, "MyNamespace:dataToStore", data.myData);
} catch(err) {
alert(err.toString());
return -1;
}
proj.xmpPacket = metaData.serialize();
}
// To get metadata from within a script, a function like so:
function getMetadata(property) {
var proj = app.project;
if(ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var metaData = new XMPMeta(proj.xmpPacket);
var schemaNS = XMPMeta.getNamespaceURI("MyNamespace");
if(schemaNS == "" || schemaNS == undefined) {
return undefined;
}
var metaValue = metaData.getProperty(schemaNS, property);
if(!metaValue) {
return undefined;
}
return metaValue.value;
}
Because the XMP functionality is an external object, you should be able to access it from outside a script, such as in a C++ IO plugin.
Christian