9 Replies Latest reply on Feb 1, 2014 7:33 PM by CarlosCanto

    Need help automating a few tasks in Illustrator CS5

    Mohi

      Hello all,

       

      I need help from scripting experts.

       

      I have created a simple action which centres my artwork to the arboard. But I want to perform some more tasks as well. Can anyone please help me write a script to do these:

       

      1. Centre artwork to the artboard

      2. Resize artboard to fit artwork

      3. Create a rectangle which exactly fits the artboard size and is sent to back Shift+Ctrl+]. It will be the background.

      4. Apply the already copied to clipart colour to the background

      5. While background is selected: Edit > Edit Colour > Recolour with Presets> 1 Colour Job > Pantone + Solid Coated

          (Which basically applies the best Pantone + Solid Coated colour to the background.

      6. Delete all unused colours from swatches

      6. Saving File as eps, legacy version: Illustrator 10 to the same directory

      7. Export a 150 dpi png to the same directory

      8. Close the file.

      9. Create a shortcut to run the script.

       

      Thanks a lot.

       

      Mohi

        • 1. Re: Need help automating a few tasks in Illustrator CS5
          W_J_T Level 4

          Welcome to the forum.

           

          Quite a large wish list you have there for a first post.

          Mohi wrote:

           

          I need help ..... Can anyone please help me write a script to do these ...

           

          Since you desire help, what have you accomplished, completed for 1 through 9 up to this point?

          • 2. Re: Need help automating a few tasks in Illustrator CS5
            Mohi Level 1

            haha thanks for your response W_J_T.

             

            The action I have created does the following:

             

            1. Centres the artwork on the artboard

            2. Creates a 2x2in rectangle.

            3. Delete unused swatches

             

            It cannot delete the unused groups from swatches.

            It cannot fit the rectangle to the artboard size.

            Neither can it apply the copied colour code to the rectangle. It start applying the hex code i copied while recording the action to the rectangle instead of taking the fresh code copied to the clipart.

            It cannot save the file to the same directory, instead it would start overwriting the file I saved while recording the action.

             

            I downloaded shrinkABtoFitArt_CS4.jsx script from adobe forum, it basically fits the artboard to artwork size. But I cannot run it from within the action. So it's quite useless. It's easier for me to manually fit artboard to artwork by using menu commands instead of using shrinkABtoFitArt_CS4.jsx.

             

            Please help me.

            • 3. Re: Need help automating a few tasks in Illustrator CS5
              W_J_T Level 4

              Mohi wrote:

               

              Please help me.

               

              So you're looking for someone just to write 1 thru 9 for you?

              • 4. Re: Need help automating a few tasks in Illustrator CS5
                Mohi Level 1

                W_J_T I don't know how to script for Illustrator. But I can try writing one if I get little bit of guidance. I have written code in VB and Flash action script ten years back but my focus shifted to print media and I have forgotten everything.

                 

                Plus there are a lot of scripts available online, I couldn't find what I was looking for but there can be someone who had been in a similar situation and have written a script or knows the url for a readymade script.

                 

                I desperately need help W_J_T.

                • 5. Re: Need help automating a few tasks in Illustrator CS5
                  Silly-V Adobe Community Professional

                  Okay, well, this all looks possible, at least- except one part- which is, what you're using to change the color for the background.  I believe someone would have to replicate the Recolor Artwork feature to match the Pantone+ colors by including the entire list of all that swatch library's swatches with all their Lab color info in the script and doing an algorithm to match up your background color to the closest one. 

                  • 6. Re: Need help automating a few tasks in Illustrator CS5
                    Mohi Level 1

                    Thanks Silly-V, can you please guide me where to download resources or how to start writing code to automate the process. I am also looking for a script to automate file creation where in a given directory Illustrator:

                     

                    1. Looks for all subdirectories and create one Illustrator 10 eps with the name of the sub folder in each subfolder. For example there are 10 folders named Folder1, Folder2... through to 10 in the given directory, Illustrator will create Folder1 Front.eps (Legacy version 10) in Folder1 and so on.

                    2. Places and embeds all files in the folder to the new file it creates. For example there is 1.eps, b.pdf, x.png in Folder1, Illustrator will place and embed all of these files in Folder1 Front.eps, save it as legacy version 10 and close it.

                    3. Illustrator looks for Source.txt on the root of given directory. Source.txt will have text info to be placed on all eps files seperated by ====== or just anything. For example,

                     

                    Folder1

                    Sample Text

                    Colour: abc

                    Font: arial

                    =====

                    Folder2

                    Sample Text b

                    Colour: edf

                    Font: tahoma

                     

                    etc.

                    Illustrator will copy and paste information specific to each folder to the eps for that folder.

                     

                    Job done

                     

                    Can you please help me sort it out.

                     

                    Thanks,

                     

                    Mohi

                    • 7. Re: Need help automating a few tasks in Illustrator CS5
                      CarlosCanto Adobe Community Professional & MVP

                      Hi Mohi, you can find all you need to get started with Scripting in Illustrator here

                       

                      http://www.adobe.com/devnet/illustrator/scripting.html

                      • 8. Re: Need help automating a few tasks in Illustrator CS5
                        Mohi Level 1

                        Hello Carlos,

                         

                        Thanks a lot for the useful link.

                         

                        And thanks a lot for fitobjecttobounds_v2 script. With the help of an action and your script I have been able to reduce work by at least 7-8%.

                         

                        My action does the following:

                        1. Centres artwork to the arboard.

                        2. Delete extra swatches.

                        3. Create a 2x2in rectangle, centre it to the artboard and send it to back.

                         

                        After this my action stops with the newly created rectangle selected.

                         

                        4. Then I click on the arboard tool and double click the main artwork to fit the artboard to artwork.

                        5. Press V to bring the selection back to the rectangle.

                        6. Press I and pick colour from the jpeg I have to match bg colour from.

                        7. Then I convert the colour to closest match PMS+ C.

                         

                        After this your script comes to action.

                         

                        8. With the rectangle still selected I press ALT+F+R+Enter to run your script and job done.

                         

                        Thanks,

                         

                        Mohi