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!
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
North America
Europe, Middle East and Africa
Asia Pacific