3 Replies Latest reply on Apr 28, 2010 2:11 AM by ISA_PMartin

    Cannot Open 'CS3 file in CS2' - programmatically handle this dialog

    ISA_PMartin

      I am running a Visual Basic app that cycles through a collection of InDesign documents performing actions. We are using CS2 and the problem occurs when a CS3 document is encountered, which hangs the app. When opening the file manually the following error dialog is encountered:

       

      Cannot open "xxxx.indd". Please upgrade your plug-ins to their latest versions, or upgrade to the lastest version of Adobe InDesign.

       

      InDesign is launched by:

      appInDesign = CreateObject("InDesign.Scripting.CS2")

       

      User interaction is suppressed:

      appInDesign.ScriptPreferences.UserInteractionLevel = InDesign.idUserInteractionLevels.idNeverInteract

       

      Documents are opened by:

      docInDesign = appInDesign.Open(<FilePath>, False)

       

      How do you handle/identify this dialog/error without user interaction (I would like to skip the file)?

       

      Thanks in advance

       

       

       

       

        • 1. Re: Cannot Open 'CS3 file in CS2' - programmatically handle this dialog
          Shonkyin Level 3

          If you opening CS3 file in CS2 you alway get error message.

           

          I think best solution is check indesign document version before opening it.

           

          I have code for checking indesign version but it is Javascript code.

           

          But it will give you idea how you can check indesign version and skip that files.

           

          Here below is code:

           

          f = File.openDialog ('Select file', undefined, false); 
          alert('Indesign version: '+getFileVersion(f)); 
          function getFileVersion(f){ 
          var IDVersion; 
          f.open('r') 
          f.seek(29, 0) 
          IDversion = f.readch().charCodeAt(0); 
          f.close(); 
          return (IDversion); 
          } 
          

           

           

          Shonky

          • 2. Re: Cannot Open 'CS3 file in CS2' - programmatically handle this dialog
            Mac_06 Level 2

            Nice Code Shonky

             

            I think this is what you are looking for Martin;

             

             

            var docInDesign, f;
            f = File.openDialog ('Select file', undefined, false); 
             
            if (getFileVersion(f) != 4){
             
             alert ("Can not open the file, Indesign Version: is " + getFileVersion(f))
             }
            else {
            app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT
            docInDesign = app.open(f);
            app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL
            }
            
            function getFileVersion(f){ 
            var IDVersion; 
            f.open('r') 
            f.seek(29, 0) 
            IDversion = f.readch().charCodeAt(0); 
            f.close(); 
            return (IDversion); 
            } 
            
            

             

            Mac

            • 3. Re: Cannot Open 'CS3 file in CS2' - programmatically handle this dialog
              ISA_PMartin Level 1

              Thanks for the post but I don't know jscript, it looks like you are opening the file as a textstream and reading the file version there?