Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Can't get this droplet to save a JPEG...

$
0
0

I'm getting an error that it can't find the document after it's opened. The actions seem to run just fine, but it stops short of actually saving the file into the newly created folder. It also doesn't close the last document.

 

Can anyone find a problem with my script? I seem to have hit a brick wall here.

(I'm running Photoshop CS6.)

____________


onopenmgItems

     setmyDateto (getcurrent date)

     setytoyearofmyDateastext

     setmtomonthofmyDateasinteger

     setdtodayofmyDateasinteger

     ifd< 10 then

          setdto "0" & dastext

     else

          setdtodastext

     endif

     ifm< 10 then

          setmto "0" & mastext

     else

          setmtomastext

     endif

setytotext -2 thru -1 ofy

setmyReleaseDatetoy& m& d& "_iPadResized"

 

repeatwithmgThisIteminmgItems

     tellapplication "System Events"

          settargetFolderPathtopathofcontainerofdisk item (mgThisItemastext)

     endtell

 

     tellapplication "Adobe Photoshop CS6"

          activate

          try

               openmgThisItem

          setmgDocNametonameofcurrent document

          settext item delimitersofAppleScriptto ".tif"

          setmgShortNametotext item 1 ofmgDocName

 

          setmgPackageFilePathtotargetFolderPath& myReleaseDate

 

          mycreateFolders(POSIX pathoffile (mgPackageFilePath))

 

          setdisplay dialogstonever

          setthisdoctocurrent document

          setdocHeighttoheightofthisdoc

          setdocWidthtowidthofthisdoc

          tellthisdoc

               flattendocument

               ifdocHeight / docWidth> 0.75 then

                    do action "iPad_tall" from "iPad Resize"

               else

                    do action "iPad_wide" from "iPad Resize"

               endif

               saveinfilemgPackageFilePathasJPEGwith options {quality:12}

          endtell

          closethecurrent documentsavingno

       onerrore

            display dialoge

       endtry

  endtell

 

endrepeat

display dialog "Files resized for iPad"

endopen

 

oncreateFolders(pathString)

     do shell script "mkdir -p " & quoted formofpathString

endcreateFolders


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>