1 Reply Latest reply on Dec 10, 2009 3:04 AM by penyfai

    List assets in InDesign Library (JS)

    penyfai Level 1

      I'm trying to get a list of assets contained in an Indesign Library using JavaScript. Been struggling for a few hours and got bruises on top of my head from running into brick walls! Can someone please put me back on track?

       

      This is what I've tried:

       

      var graphicLibrary = new

      File("/Volumes/ColourPrint/InDesign_Adverts/99/99999999_library.indl");

      if (graphicLibrary.exists)

      {

      app.open(File("/Volumes/ColourPrint/InDesign_Adverts/99/99999999_library.indl"));

      }

      else

      {

      alert("Creating new Library");

      var graphicLibrary = app.libraries.add(File("/Volumes/ColourPrint/InDesign_Adverts/99/99999999_library.indl")) ;

      }

      //get graphics associated with the advert

      var getGraphics = getGraphicsFunc();

       

       

       

      function getGraphicsFunc()

      {

      //test for graphics in Library

       

      alert(graphicLibrary);

      libList = app.getElements("99999999_library");

      alert(libList);

      }

       

      This opens an existing library or creates a new one well enough, but the last bit, where I'm trying to get my list of assets or elements is letting me down.

       

       

       

      Cheers in advance......

        • 1. Re: List assets in InDesign Library (JS)
          penyfai Level 1

          After much searching: I finally got to Dave Saunder's blog, that contained the one line I needed to put me right.

           

          and here it is!!!

           

           

          graphiclist = mylib.assets.everyItem().name;

           

           

          My head is mush after 3 fruitless days - but if this helps anyone else, then all well and good.

           

          Thanks for putting this on your blog Dave.

           

          Andrew