Harbs, I just dragged a page element to my desktop and looked at the xml created by the snippet and I see my key value pairs. I want to have a script that will save a temporary snippet file, parse my key value pairs, and then delete the file but I only want to export my selection as a snippet. Is that even possible?
Here's a generic function to extract all value pairs from an object with some code showing how to use it...
var vals = GetValuePairs(app.selection[0]);
for(var x in vals){
alert(x + " is " + vals);
}
function GetValuePairs(obj){
var file = File(Folder.temp + "/temp.idms");
obj.exportFile(ExportFormat.INDESIGN_SNIPPET,file);
file.open('r');
var contents = file.read();
file.close();
var contXML = XML(contents);
var vals = {}
for each(var pair in contXML..KeyValuePair){
vals[pair.@Key] = pair.@Value;
}
return vals;
}
Harbs