9 Replies Latest reply on Jun 21, 2017 8:05 AM by Trevorׅ

    Opening Illustrator document as a template / copy?

    Trevorׅ Adobe Community Professional

      Hi All,

       

      Is there any way as opening an Illustrator document as a template / copy?

      app.executeMenuCommand('newFromTemplate'); doesn't provide an option to include the file path.

      I know I can open a doc as the original and do saveAs but I am not looking for that.

      JSX, Applescript or terminal command solutions would all be good but not UI based ones.

       

      Thanks

      Trevor

        • 1. Re: Opening Illustrator document as a template / copy?
          moluapple Level 4

          Hi, can you accept this solution ?

          var f = File.openDialog ('Select the file...', '*.ai'),
              n = f.name;
          f.rename (f.name + 't');
          app.open(f);
          f.rename (n);
          
          1 person found this helpful
          • 2. Re: Opening Illustrator document as a template / copy?
            Trevorׅ Adobe Community Professional

            Thanks for the suggestion. I had thought of it but I'm not excited about it.

            The same applies to duplicating the file and renaming it although I think I will end up doing that.

            • 3. Re: Opening Illustrator document as a template / copy?
              Vinothmannu Level 1

              This may help you.

               

              #target illustrator

               

              var dialogBox =

                  "dialog { orientation: 'column', alignChildren: 'center', \

                      info: Group { orientation: 'column', alignChildren: 'center', \

                      templateType: Group { orientation: 'column', alignChildren: 'center', margins: 0, \

                          rbtn1:  {  text: 'Select the template file', assignmet: 'left'}, \

                          dividerLine: Panel { preferredSize: [280,1], margins:0,},\

                          componentsGroup: Group { alignChildren: 'right' , orientation: 'column' ,\

                          componentList: ListBox {preferredSize: [260,150], left: 100, properties:{multiselect:false} align:'right'}, \

                          st:StaticText {text:'', preferredSize:[280,0]},\

                          applySkinTo: Group { orientation: 'row' , alignChildren: 'top',\

                          },\

                          },\

                      }, \

                  }, \

                          dividerLine: Panel { preferredSize: [280,1], margins:0,},\

                          buttons: Group { orientation: 'row', \

                          ok: Button { text: 'OK', properties:{name:'ok'} }, \

                          cancel: Button { text: 'Cancel', properties:{name:'cancel'} }, \

                          } \

              }";

               

               

              win = new Window (dialogBox);

              win.text = "Graphics";

               

               

              var lstbx = win.info.templateType.componentsGroup.componentList;

               

               

              var templatePath;

              var templateComponentPath;

               

               

              if($.os.substring(0,3)=="Win")

              {

                templatePath = " "; // Pl. provide the path

                templateComponentPath =  templatePath + "/template";

              }

               

               

              var templateFolder = new Folder(templateComponentPath);

               

               

              var files = templateFolder.getFiles();

              for (i = 0; i < files.length; ++i)

              {

                var fileName = files[i].name;

                var index = fileName.lastIndexOf(".ait");

                if(index != -1)

                {

                var onlyFileName = fileName.substring(0,index);

                lstbx.add("item",File.decode(onlyFileName));

                }

              }

               

               

              win.buttons.ok.onClick = function()

              {

                var doc1;

               

               

                if(win.info.templateType.rbtn1.value)

                {

                  var componentPath = templateComponentPath + "/"+ lstbx.selection.text + ".ait";

                doc1 = app.open (new File(componentPath));

                }

                else

                {

                var componentPath = templateComponentPath + "/"+ lstbx.selection.text + ".ait";

                doc1 = app.open (new File(componentPath));

                }

                win.close(0);

              }

               

               

              win.buttons.cancel.onClick = function()

              {

                win.close(0);

              }

               

               

              win.center();

              win.show();

              • 4. Re: Opening Illustrator document as a template / copy?
                Trevorׅ Adobe Community Professional

                Thanks for your reply.

                It's not what I'm after.

                 

                 

                • 5. Re: Opening Illustrator document as a template / copy?
                  Silly-V Adobe Community Professional

                  I am wondering, why did you need to do these steps instead of using the simple open -> process > Save-As process?

                  • 6. Re: Opening Illustrator document as a template / copy?
                    Trevorׅ Adobe Community Professional

                    Hi Silly,

                     

                    I am batch processing PDF files that can contain up to about 200,000 path objects, the object can be sometimes a bit complicated.

                    The can be sometimes 100s of these files.

                     

                    My client says all the files are backed up but I would rather avoid touching them to avoid any risk of corrupting them.

                    If I were to be more of a risk player I could open them and do save as strait away on Ai and then process and save again. 2 X save as like you are thinking, right?

                     

                    We'll how many extra hours would it take to do the more risky method? I don't know but it certainly would be a lot.

                     

                    Convinced ;-)

                     

                    Trevor

                    • 7. Re: Opening Illustrator document as a template / copy?
                      Trevorׅ Adobe Community Professional

                      Well I see you had in mind just 1 save as, that's just too risky.

                      • 8. Re: Opening Illustrator document as a template / copy?
                        Silly-V Adobe Community Professional

                        See, I was under impression that when you 'open' a file in AI, it actually copies the file inside the application - so unlike other kinds of applications such as Excel, where you can't delete a file that's open in Excel right now, in the file system, you can delete an AI file that's already opened and it won't even complain at you. I also think that is why when you drag a file into the app fame of AI or PS, etc, it will show the tooltip "copy" near the cursor.

                        • 9. Re: Opening Illustrator document as a template / copy?
                          Trevorׅ Adobe Community Professional

                          I don't know, maybe you are correct.