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

Export library to snippets

Community Beginner ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

Hi

I'm new to scripting, but i have managed to patch together this script. (Much thanks to tips from people at this forum (Green4ever: snippetexport and tomaxxi: grouping).

The script exports every item (asset) in a library to individual snippet files. The files get their names from the library items. Does anyone know if its possible to export the snippets whithout grouping it?

myLibrary = app.libraries[0];

myLibraryPanel = myLibrary.associatedPanel;

 

for( i = 0; i < app.libraries[0].assets.length; i++ ){

    var myObj = app.libraries[0].assets.placeAsset(app.documents[0])[0];

    var myName = app.libraries[0].assets.name

    var myGroup = new Array();

    myGroup = app.activeWindow.activeSpread.pageItems;

       

         if (app.activeWindow.activeSpread.pageItems.length >1){

        app.activeWindow.activeSpread.groups.add(myGroup);

        var obj = app.activeWindow.activeSpread.pageItems.everyItem();

        obj.exportFile(ExportFormat.INDESIGN_SNIPPET, File("/path/"+ myName + ".idms"));

        obj.remove(0);     

      }

else { }

    var obj = app.activeWindow.activeSpread.pageItems.everyItem();

    obj.exportFile(ExportFormat.INDESIGN_SNIPPET, File("/path/"+ myName + ".idms"));

    obj.remove(0);

}

TOPICS
Scripting

Views

1.4K

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
Enthusiast ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

Hi,

eportFile-method is assigned to single Page items, so as far as I know, there's no way around grouping here ...

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 ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

Ok. Thank you!

Trond

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
Guest
Apr 04, 2013 Apr 04, 2013

Copy link to clipboard

Copied

This is something i have been wanting to do for a long time, but I can't get your script to work.

Should this work in CS4

Don't surpose you could post someplace the actual script

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 12, 2013 Jul 12, 2013

Copy link to clipboard

Copied

LATEST

Hi

This is the actual script and it works in CS4. You have to have a document and the library open.

Trond

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