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

Open all source documents of current active doc

Community Beginner ,
Jul 13, 2015 Jul 13, 2015

Copy link to clipboard

Copied

Hey all,

I'm trying to write my first script using ExtendScript. What I'd like is for the script to open the source documents for all the insets in the current active document.

I think I'm quite close, but I'm having trouble finding the correct method to call to get the filepath for the current inset. So far I have:

function main ()

{

    var doc = app.ActiveDoc;

    if (!doc.ObjectValid())

    {

        alert("No active document in focus");

        return;

    }

    var inset = doc.FirstTiInDoc;

   

    while (inset.ObjectValid())

    {

        // open source document

        var sourceFilepath = inset.InsetFile;           <<--- this doesn't work

        openFile(sourceFilepath);

       

        // move to next inset

        inset = inset.NextTiInDoc;

    }

    return ("Script Complete");

}

function openFile (filename)

{

    var openParams = GetOpenDefaultParams();

    var i = GetPropIndex(openParams,Constants.FS_FileIsOldVersion);

    openParams.propVal.ival=Constants.FV_DoOK;

    i = GetPropIndex(openParams,Constants.FS_FontNotFoundInDoc);

    openParams.propVal.ival = Constants.FV_DoOK;

    i = GetPropIndex(openParams,Constants.FS_FileIsInUse);

    openParams.propVal.ival = Constants.FV_OpenViewOnly;

    i = GetPropIndex(openParams,Constants.FS_AlertUserAboutFailure);

    openParams.propVal.ival = Constants.FV_DoCancel;

    i = GetPropIndex(openParams,Constants.FS_LockCantBeReset);

    openParams.propVal.ival = Constants.FV_DoOK;

    var returnParams = new PropVals();

    var fileObj = Open(filename, openParams, returnParams);

   

    return fileObj;

}

I've tried inset.InsetFile and inset.filePath, but neither work. Can anyone tell me the correct syntax? Thanks!

TOPICS
Scripting

Views

595

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

correct answers 1 Correct answer

Community Expert , Jul 13, 2015 Jul 13, 2015

Try TiFile

-Rick

Votes

Translate

Translate
Community Expert ,
Jul 13, 2015 Jul 13, 2015

Copy link to clipboard

Copied

Try TiFile

-Rick

Votes

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
Community Beginner ,
Jul 14, 2015 Jul 14, 2015

Copy link to clipboard

Copied

LATEST

Excellent, thank you very much Rick!

Votes

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