4 Replies Latest reply on Aug 28, 2013 4:10 AM by Bill joy

    How Save File using script ?

    Bill joy Level 1

      Hi Expert

       

      I am using MAC OSX 10.8.3 and InDesign CS5.5

       

      I use this script to save the InDesign file and run this script using Adobe ExtendScript ToolKit CS5.5

       

      #target indesign

      var myDocument=app.activeDocument;

      myDocument.save(File("/var/New.indd"));   

       

      But Script give error

       

      can not save "untitle1.indd" under a new name

      where "untitle1.indd" is created indesign file name.

       

      Is it Script proble or InDesign problem

      or

      MAC OSX problem ?

       

      How save file  ?

       

      Thanks.

        • 1. Re: How Save File using script ?
          BEGINNER_X Level 3

          Hi Bill,

           

          Please use this code:

           

          app.activeDocument.save(File("~/Desktop/New.indd"));

           

          Regards

          Beginner_X

          • 2. Re: How Save File using script ?
            Jump_Over Level 5

            Bill joy wrote:

             

            ..

            Is it Script proble or InDesign problem

            or

            MAC OSX problem ?

            ....

             

            Hi Bill,

             

            I think it is your path problem. (Are you able to save this file in UI there?)

             

            Check:

            mFile = new File("/var/New.indd");
            mFile.isValid;
            

            You can't go forward until above == true;

             

            You could check how your system records a path using this in ESTK:

            mFile = File.saveDialog();
            

             

            select any file and check ESTK console.

            Script is creating a new File object with path you can see (not saving anything), so do it same way.

             

            If you will pass above with true save a doc using:

            mDoc.save(mFile);
            

             

            Jarek

            1 person found this helpful
            • 3. Re: How Save File using script ?
              Bill joy Level 1

              Thanks For Reply

              • 4. Re: How Save File using script ?
                Bill joy Level 1

                Thanks Jarek for reply

                Also thenks to Beginner_X

                 

                I found the MAC OSX permission problem.

                If  i use

                #target indesign

                var myDocument=app.activeDocument;

                myDocument.save(File("/Applicaion/NewFolder/New.indd"));   

                 

                Then Script run successfully run and save "Untitle1.indd" file at location

                /Applicaion/NewFolder/      with name "New.indd".

                 

                But if i use "/var/" path to save the file then it give error

                can not save "untitle1.indd" under a new name

                 

                I think it is  MAC OSX permission problem.

                How solve this MAC OSX permission problem that I save my document file at any location on my MAC system using script

                 

                #target indesign

                var myDocument=app.activeDocument;

                myDocument.save(File("---filepath/filename.indd-----")); 

                 

                 

                Thanks