• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDF to JPG
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDF to JPG


  • Subject: Re: PDF to JPG
  • From: "Stockly, Ed" <email@hidden>
  • Date: Fri, 27 Feb 2015 19:00:50 +0000
  • Thread-topic: PDF to JPG

Thanks all, here's what I'm using:

on run

set the pdfImageFolder to choose folder with prompt "Select a folder of PDF images:"

tell me to open {pdfImageFolder}

end run


on open (theFolders)

repeat with pdfImageFolder in theFolders

repeat 1 times

set AppleScript's text item delimiters to {""}

tell application "Finder"

if kind of pdfImageFolder is not "Folder" then exit repeat

set imageFolderLocation to container of the pdfImageFolder

set the pdfImages to (every file of the pdfImageFolder whose name extension = "PDF")

end tell

set jpgOutputFolder to my EstablishFolder(imageFolderLocation, "PDF and JPG Files")

tell application "Image Events" to launch

repeat with x from 1 to count of the pdfImages

set thisFile to item x of the pdfImages as alias

tell application "Finder"

set thisFileName to the name of thisFile

set AppleScript's text item delimiters to {",_", ",", "_", "-"}

set thisFileName to text items of thisFileName

set AppleScript's text item delimiters to {"_"}

set thisFileName to thisFileName as text

try

set the name of thisFile to thisFileName

on error errMsg number errNum

-- display dialog errMsg 

end try

end tell

tell application "Image Events"

set the pdfImageReference to open thisFile

tell the pdfImageReference

set the pdfImageName to name

set AppleScript's text item delimiters to {".pdf"}

set the pdfImageName to text item 1 of the pdfImageName

save in ((jpgOutputFolder as text) & the pdfImageName & ".jpg") as JPEG

end tell

end tell

tell application "Finder" to move thisFile to jpgOutputFolder with replacing

end repeat

end repeat

end repeat

end open


on EstablishFolder(folderLocation, myFolderName)

set newFolderPath to (folderLocation as string) & myFolderName

try

repeat

set newFolderPath to (folderLocation as string) & myFolderName

set existingItem to alias newFolderPath

tell application "Finder"

if kind of existingItem is "folder" then

return existingItem

else

if the last character of newFolderPath = "ƒ" then error "Can't Make Folder"

set myFolderName to myFolderName & "ƒ"

end if

end tell

end repeat

on error errorText number errNum

tell application "Finder"

try

make new folder at folderLocation

set NewFolder to the result as alias

set the name of NewFolder to myFolderName

on error errorText number errNum

if errNum = -48 then

return newFolderPath as alias

else

display dialog errorText & return & errNum

end if

end try

end tell

end try

return NewFolder as alias

end EstablishFolder


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: PDF to JPG
      • From: Shane Stanley <email@hidden>
References: 
 >PDF to JPG (From: "Stockly, Ed" <email@hidden>)
 >Re: PDF to JPG (From: Emmanuel LEVY <email@hidden>)
 >Re: PDF to JPG (From: "Stockly, Ed" <email@hidden>)
 >Re: PDF to JPG (From: Jörgen Stahle <email@hidden>)

  • Prev by Date: Re: PDF to JPG
  • Next by Date: Re: Can copy or paste in dialogs in Adobe InDesign CS6
  • Previous by thread: Re: PDF to JPG
  • Next by thread: Re: PDF to JPG
  • Index(es):
    • Date
    • Thread