• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extract graphics in separated fm files

Community Beginner ,
Jun 19, 2014 Jun 19, 2014

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?

TOPICS
Scripting

Views

250

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation