1 Reply Latest reply on Aug 4, 2010 2:31 AM by Marc Autret

    Check for libraries with a startup script


      Is it possible to check for open libraries with a startup script?  Currently, i'm trying like this:




      If InDesign is already open, this code works correctly (that is, if the library is open, nothing happens, otherwise it opens the library).  However, if I place this in the startup script folder, it will open a second (third, fourth, etc.) copy of the library, even if the library is already open.


      I think this happens because the library files are opened later in the startup sequence then the startup scripts are run.  Is there any way to work around this?





        • 1. Re: Check for libraries with a startup script
          Marc Autret Level 4

          Is your script supposed to work in ID CS3, or later?


          Anyway, InDesign CS4 seems to reopen the libraries before launching startup scripts, so the following code works for me:


          // Startup Script
          const libName = "Marks.indl",
            libPath = "/Support/InDesign/Lib/";
          var libFile = libPath + libName;
          if( !app.libraries.itemByName(libName).isValid )
            try {app.open(File(libFile))}
            catch(_){alert("Unable to open the library:\r"+libFile);}