9 Replies Latest reply on Jul 4, 2014 2:46 AM by Muppet Mark

    Save As JPEG in AppleScript

    PeterRHawkes Level 1

      Trying to Save a PSD file as JPEG using the script from the Adobe scripting documentation.

       

      The following code opens the standard Save As dialog box rather than simply saving the file, I am missing something ... but what??!

       

      tell application "Adobe Photoshop CC"

       

                set theDocument to current document

       

                set myFile to "Macintosh HD:Users:peterrhawkes:Desktop:MH.jpg"

                set myOptions to ¬

                          {class:JPEG save options, embed color profile:true, quality:12} ¬

       

        save theDocument in file myFile as JPEG with options ¬

        myOptions appending no extension without copying

       

      end tell

        • 1. Re: Save As JPEG in AppleScript
          c.pfaffenbichler Level 9

          I think pretty much only one of the »top participants« here bothered with AppleScript and I’m not sure he still drops by regularly.

          Maybe you should consider switching to JavaScript for automating Photoshop tasks.

          • 2. Re: Save As JPEG in AppleScript
            chris breu

            hi

             

            there are some good reasons to use applescript – not only photoshop is working on a mac.

            with applescript it is possible to build automation tasks over the whole system including various applications.

             

             

            have fun.

            • 3. Re: Save As JPEG in AppleScript
              c.pfaffenbichler Level 9
              there are some good reasons to use applescript
              with applescript it is possible to build automation tasks over the whole system including various applications.

              I’d call that one reason, so the plural "reasons" might be considered contestable.

              • 4. Re: Save As JPEG in AppleScript
                chris breu Level 1

                hi peter

                 

                I faced a general error with no further information in photoshop cc when I used your code for a try, even there was no save as dialog box.

                for me it helped to declare the destination path as string.

                 

                tell application "Adobe Photoshop CC"

                 

                  set theDocument to current document

                 

                  set myFile to "System:Users:imac7:Desktop:MH.jpg" as string

                  set myOptions to ¬

                  {class:JPEG save options, embed color profile:true, quality:12} ¬

                 

                  save theDocument in file myFile as JPEG with options ¬

                  myOptions appending no extension without copying

                 

                end tell

                 

                hope this helps.

                have fun.

                • 5. Re: Save As JPEG in AppleScript
                  chris breu Level 1

                  another one is: be yourselfdon't do anything just because everyone else is doing it or as well known think different!

                  • 6. Re: Save As JPEG in AppleScript
                    c.pfaffenbichler Level 9

                    Your AppleScript savvy is certainly welcome as I have the impression the one "regular" with significant AS experience is not dropping by much anymore.

                     

                    don't do anything just because everyone else is doing it

                    I see no moral preferability to either AS or JavaScript so doing it the same way as most others does not seem to be detestable in itself and the number of people using them does not proof or disproof their respective qualities.

                    Many people who come to this Forum with their automation problems are beginners at Scripting and need help – help that in the case of JavaScript a certain number of other contributors may be able to provide and in the case of AppleScript a (based on my observations) smaller number of other contributors may be able to provide.

                    There might be benefits in learning and utilising as big a number of languages as possible, but for many people that may not be the immediately preferable option.

                    Each person coming freshly to this matter has to make their own decisions but should one really base the decision on which language to use/learn on some individualistic or romantic imagery instead of trying to weigh the pros and cons?

                    • 7. Re: Save As JPEG in AppleScript
                      Muppet Mark Level 5

                      I do check in from time to time...

                      Trying to get self-employment off the ground. So less time to post here.

                       

                      I can't help because I'm not on CC yet.

                       

                      I did find more difference between app

                      Versions when AppleScripting.

                       

                      At a glance the syntax looks ok...

                       

                      PS now prefers file paths as strings

                      And not alias...

                       

                      Looks like the next Apple OS will have

                      JavaScript added to its apps...

                       

                      Sent from my iPhone

                      • 8. Re: Save As JPEG in AppleScript
                        c.pfaffenbichler Level 9

                        I do check in from time to time...

                        I hope my observation did not come off as reproachful or disrespectful.

                         

                        Best of luck and have a good weekend!

                        Pfaffenbichler

                        • 9. Re: Save As JPEG in AppleScript
                          Muppet Mark Level 5

                          No not all... I do get updates from the forums.

                           

                          Most of the time I can rest knowing others

                          will respond before I have the time to.

                           

                          I would say that I had more problems with AppleScript over ExtendScript.

                           

                          I do understand the OPs reasons though.

                           

                          As of CS5 I did have issues just getting a

                          reference to the current document.

                           

                          Work on script first run in SE then after

                          that broken until relaunch...

                           

                          Sent from my iPhone