Skip navigation
heatherb555
Currently Being Moderated

Importing formats from another file

Mar 26, 2012 1:01 PM

Tags: #framemaker10 #extendscript #beginner

Hi everyone,

 

First, I should say thanks for all the posts. It has definitely helped a newbie like me.

 

I'm trying to import formats from another file. When set to import from the doc itself, it works great. I just can't figure out how to reference another file.

 

Here is what I have (that's not working) :-}

 

function ImportFormats(doc) {

    var FormatFlags = Constants.FF_UFF_PGF | Constants.FF_UFF_FONT | Constants.FF_UFF_PAGE |

          Constants.FF_UFF_TABLE | Constants.FF_UFF_COLOR | Constants.FF_UFF_REFPAGE | Constants.FF_UFF_REMOVE_EXCEPTIONS;

   

    var FactsFile =File("C:\pg000_facts_table.fm");

 

  doc.SimpleImportFormats (FactsFile, FormatFlags);

 

    }\

 

Thanks again!

 
Replies
  • Currently Being Moderated
    Mar 29, 2012 5:00 AM   in reply to heatherb555

    Heather,

     

    The doc that is requested as the first parameter to SimpleImportFormats is NOT simply the file name. You need to open the file using the global functions SimpleOpen or Open to get a document handle. That handle is the one you pass to SimpleImportFormats.

     

    Using SimpleIOpen is easier to code but if you want to suppress the File Open dialog (by setting the interactive parameter to false), any kind of problem preventing Frame to simply open the file will not be notified. I would invest the couple of extra coding lines and use Open, as you can tell Frame to ignore all kinds of possible stuff (updating references, missing fonts etc.) and simply open the requested file.

     

    Also, note that the backslash has to be escaped with a backslash in a string, i.e. your filename should be "C:\\pg000_facts_table.fm". The backslash is used to indicate special characters like a newline (\n) or a tab (\t) etc. One of those special characters is the backslash (\\).

     

    Welcome to the wonderful world of ExtendScript !

     

    Jang

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points