8 Replies Latest reply on Jun 6, 2016 3:08 PM by Kevin Parrott

    I want to Export JPEG - Applscript

    karthickm50893796 Level 1

      1 } Here is my Applescript , I want to save without .ai i don't  why its coming with _JPEG ( i need "filename_JPEG.jpg" - i am getting "filename.ai_JPEG.jpg") if u run this applescript u came understand..

       

      set saveLocation to ((path to desktop) as string)
      set theFile to choose file
      tell application "Finder" to set fileName to name of theFile
      set fullPath to (saveLocation & fileName)
      set extension to "_JPEG.jpg"
      set VectorPath to fullPath & extension
      tell application "Adobe Illustrator"
       activate
       export current document to file VectorPath as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false}
      end tell
      

       

      2} it is possible to export "filename_HIGH.jpg"

       

      set saveLocation to ((path to desktop) as string)
      tell application "Adobe Illustrator"
       activate
       export current document to file saveLocation as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false}
      end tell
      
        • 1. Re: I want to Export JPEG - Applscript
          Kevin Parrott Level 2

          try this

          set saveLocation to ((path to desktop) as string)

          set theFile to choose file

          tell application "Finder" to set fileName to name of theFile

           

          tell (info for theFile) to set {_Name, _Extension} to {name, name extension}

          set fileName to text 1 thru ((get offset of "." & _Extension in _Name) - 1) of _Name

           

          set fullPath to (saveLocation & fileName)

          set extension to "_JPEG.jpg"

          set VectorPath to fullPath & extension

          tell application "Adobe Illustrator"

              activate

              export current document to file VectorPath as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false}

          end tell

          • 2. Re: I want to Export JPEG - Applscript
            karthickm50893796 Level 1

            its work good,

             

            But every time script ask to choose file. If i select any file that file name as been saved on file name include _JPEG

             

            Basically i want to export file to desktop and my file name should be current open document as file name with _JPEG

            • 3. Re: I want to Export JPEG - Applscript
              karthickm50893796 Level 1

              Small structure how i need applescript.....

              Screen Shot 2016-05-31 at 1.08.25 PM.png

              • 4. Re: I want to Export JPEG - Applscript
                Kevin Parrott Level 2

                this now creates a folder on the desktop, saves original ai file to it as well as jpg and pdf, for the

                pdf you will need to create a pdf preset.

                 

                 

                 

                set saveLocation to ((path to desktop) as string)

                set theFile to choose file

                tell application "Adobe Illustrator"

                    open theFile without dialogs

                end tell

                tell application "Finder"

                    set fileName to name of theFile

                    tell (info for theFile) to set {_Name, _Extension} to {name, name extension}

                    set fileName to text 1 thru ((get offset of "." & _Extension in _Name) - 1) of _Name

                    if the folder fileName of desktop exists then

                        activate me

                        display dialog "Folder with the sams name exists" -- buttons {"Yes", "No"}

                    else

                        set SaveFolder to make new folder at saveLocation with properties {name:fileName}

                        set aFolder to SaveFolder

                        set aPath to aFolder as text

                     

                        set fullPath to (aPath & fileName)

                        set extensionJ to "_JPEG.jpg"

                        set extensionP to "_PDF.pdf"

                        set VectorPathJ to fullPath & extensionJ

                        set VectorPathP to fullPath & extensionP

                 

                 

                     

                        tell application "Adobe Illustrator"

                            save current document in file aPath with replacing

                            save current document in file VectorPathP as pdf with options {class:PDF save options, PDF preset:"TEST RIP"} with replacing --You must setup a PDF preset

                            export current document to file VectorPathJ as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false} with replacing

                            close document 1 saving no

                        end tell

                    end if

                end tell

                • 5. Re: I want to Export JPEG - Applscript
                  karthickm50893796 Level 1

                  giphy.gif

                   

                  I am not understand how did u do this, can u teach me.......

                   

                  only one change i need convert this to Batch Process please.... it is possible Kevin Parrott

                  • 6. Re: I want to Export JPEG - Applscript
                    Kevin Parrott Level 2

                    this is a bit clunky, but it works, save this as an application, you can drop as many ai files on this as you wish

                     

                    File-Export-File Format-Application  

                     

                     

                    on open these_items

                       

                        repeat with i from 1 to the count of these_items

                           

                            set this_item to (item i of these_items)

                           

                            set theFile to this_item as alias

                           

                            tell application "Adobe Illustrator"

                                set user interaction level to never interact

                                open theFile without dialogs

                            end tell

                           

                            tell application "Finder"

                               

                                set fileName to name of theFile

                               

                                tell (info for theFile) to set {_Name, _Extension} to {name, name extension}

                                set fileName to text 1 thru ((get offset of "." & _Extension in _Name) - 1) of _Name

                               

                                if the folder fileName of desktop exists then

                                    activate me

                                    display dialog {"A folder with the name " & "- " & fileName & " -" & " already exists

                    it will be tagged as DUPLICATE." as text} buttons {"OK"}

                                    set name of folder fileName to fileName & "-DUPLICATE"

                                   

                                    set saveLocation to ((path to desktop) as string)

                                    set SaveFolder to make new folder at saveLocation with properties {name:fileName}

                                    set aPath to SaveFolder as text

                                   

                                    set fullPath to (aPath & fileName)

                                    set PDF_Path to fullPath & "_PDF.pdf"

                                    set JPEG_Path to fullPath & "_JPEG.jpg"

                                   

                                    tell application "Adobe Illustrator"

                                        save current document in file aPath with replacing

                                        save current document in file PDF_Path as pdf with options {class:PDF save options, PDF preset:"TEST RIP"} with replacing --You must setup a PDF preset

                                        export current document to file JPEG_Path as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false} with replacing

                                        close document 1 saving no

                                    end tell

                                   

                                else

                                   

                                    set saveLocation to ((path to desktop) as string)

                                    set SaveFolder to make new folder at saveLocation with properties {name:fileName}

                                    set aPath to SaveFolder as text

                                   

                                    set fullPath to (aPath & fileName)

                                    set PDF_Path to fullPath & "_PDF.pdf"

                                    set JPEG_Path to fullPath & "_JPEG.jpg"

                                   

                                    tell application "Adobe Illustrator"

                                        save current document in file aPath with replacing

                                        save current document in file PDF_Path as pdf with options {class:PDF save options, PDF preset:"TEST RIP"} with replacing --You must setup a PDF preset

                                        export current document to file JPEG_Path as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false} with replacing

                                        close document 1 saving no

                                    end tell

                                   

                                end if

                            end tell

                        end repeat

                    end open

                    • 7. Re: I want to Export JPEG - Applscript
                      karthickm50893796 Level 1

                      Thanks Kevin Parrott

                       

                      Different between using PDF present,  see below i attached a script with out PDF present but its work fine.....

                      please check and explain why we are using PDF present!!!!!!!!

                       

                      set PDF_Desktop to ((path to desktop folder) as string)

                      tell application "Adobe Illustrator"

                        tell current document

                        save in file (PDF_Desktop) as pdf with options {class:PDF save options, preserve editability:true}

                        end tell

                      end tell

                      • 8. Re: I want to Export JPEG - Applscript
                        Kevin Parrott Level 2

                        I prefer pdf presets as it gives me more control over what I want in the final PDF.

                         

                        Place this into your scripts folder, this now deals with only the open document.

                         

                         

                        tell application "Adobe Illustrator" to set theFile to file path of document 1

                        tell application "Finder"

                            set fileName to name of theFile

                            tell (info for theFile) to set {_Name, _Extension} to {name, name extension}

                            set fileName to text 1 thru ((get offset of "." & _Extension in _Name) - 1) of _Name

                            set saveLocation to ((path to desktop) as string)

                            set SaveFolder to make new folder at saveLocation with properties {name:fileName}

                            set aPath to SaveFolder as text

                            set fullPath to (aPath & fileName)

                            set PDF_Path to fullPath & "_PDF.pdf"

                            set JPEG_Path to fullPath & "_JPEG.jpg"

                            tell application "Adobe Illustrator"

                                save current document in file aPath with replacing

                                save document 1 in file PDF_Path as pdf with options {class:PDF save options, view pdf:true} with replacing

                                export current document to file JPEG_Path as JPEG with options {class:JPEG export options, artboard clipping:true, quality:70, horizontal scaling:100, vertical scaling:100, antialiasing:false} with replacing

                                close document 1 saving no

                            end tell

                        end tell

                        1 person found this helpful