Copy link to clipboard
Copied
Hello,
I am a beginner in ExtendScript and I need to outsource the graphics of my docs. I wish to create a file .fm for each graph found in the doc to be able to generate the images apart and not have to rebuild for each change of doc.
I advance slowly with the docs and examples that I found but I still can not do what I want.
For now I wanted to do this as follows:
var doc = app.ActiveDoc;
if(doc.ObjectValid()) {
var inset = doc.FirstGraphicInDoc;
while(inset) {
// Create empty doc from a template
var newDoc = SimpleNewDoc(File($.fileName).parent.fsName+ "\\" + "DocGraphicTemplate", 0);
// Insert graphic in created doc.
// I still don't know how to do this...
newDoc.addGraphic(inset);
// Save doc with graphic in .fm file
newDoc.Save(docPath, newDoc, params);
// Replace graphic element in doc by the image generated from the newDoc .fm file
// I still don't know how to do this too
inset=inset.NextGraphicInDoc
}
} else {
alert("No active document could be found!");
}
Is this the right way to do? If so can someone help me on the sticking points?
Have something to add?