2 Replies Latest reply on Feb 18, 2011 1:54 AM by Muppet Mark-QAl63s

    Need a little help here

    IVIastaIVIind Level 1

      I have written an applescript which basically asks the user to select the source folder, then PS fires up, adjusts the images as needed, then saves the changed image to the temp folder that was created.  The problem I'm running into is that it all goes fine until the save section, can anyone give me a hand at what I need to change to get this up and running? I'm attaching the script below.

       

      -- Get users input for which folder PS will work from
      set tempFolderName to "Temp"
      set inputFolder to choose folder

       

      -- Has finder setup a "temp" folder within the chosen directory
      tell application "Finder"
          set filesList to files in inputFolder
          if (not (exists folder ((inputFolder as string) & tempFolderName))) then
              set outputFolder to make new folder at inputFolder with properties {name:tempFolderName}
          else
              set outputFolder to folder ((inputFolder as string) & tempFolderName)
          end if
      end tell

       

      -- Starts Photoshop CS5 with restrictions
      tell application "Adobe Photoshop CS5"
          set display dialogs to never
          close every document saving no
      end tell

       

      -- Start of the decision on proper scaling of the images

       

      repeat with aFile in filesList
         
          set fileIndex to 0
         
          tell application "Finder"
              set theFileName to name of aFile
              set theFile to aFile as string
          end tell
         
          tell application "Adobe Photoshop CS5"
             
              open alias theFile
             
              -- Setting Document Variables for width and height       
              set docRef to the current document
              set docHeight to height of docRef
              set docWidth to width of docRef
             
              if (docHeight > docWidth) then
                  do action "Tall Edit" from "MMS"
              end if
              if (docHeight < docWidth) then
                  do action "Wide Edit" from "MMS"
              end if
              if (docHeight = docWidth) then
                  do action "Equal Edit" from "MMS"
              end if
             
              set myOptions to {class:JPEG save options, embed color profile:false, format options:standard, matte:background color matte}
              save current document in outputFolder as JPEG with options myOptions appending no extension without copying
          end tell
      end repeat