Hi Bazzie,
Thanks for the suggestions. They perfectly rename the files however, it seems that I failed to incorporate the script to accomplish the task I want to. I am not a script writer but tries to manipulate the things as per my requirement.
Here is the scenario:
There are two JPGs in a folder as mentioned earlier. Now I would like to open those two JPGs in Adobe Photoshop CS6/CC, perform a task and then Save-As with a new name with Kindle in between the filename:
Let say the script would be something like:
-
Open both the files using drag & drop on the AppleScript Droplet or using the “set theLocation to (target of front window)”
-
Perform a common photoshop task on each file one by one i.e.
tell application "Adobe Photoshop CS6"
change mode to RGB
resize image height 1000 as pixels
save oldFile in file NewFile as JPEG with options jpgOptions with copying
end tell
-
save the Back cover file as “xxxxxxxxxxx_Kindle Back Cover.jpg”
-
save the Front cover file as “xxxxxxxxxxx_Kindle Front Cover.jpg”
Given below is my old script which I successfully altered to create two different versions for the Kindle. But rather than repeating the process, I would like to create the two Kindle versions from the existing JPGs.
This script uses a PDF to perform a task (altered to create Kindle versions):
on open theItems
-- set pageWidth to text returned of (display dialog "Enter the page width (in inches)" default answer 6)
repeat with thefile in theItems
tell application "System Events"
set {name extension:fileExtension, container:parentFolder} to thefile
set parentFolder to path of parentFolder
end tell
if fileExtension is "pdf" then
set pageWidth to text returned of (display dialog "Enter the page width (in inches)" default answer 6)
set pageWidth to pageWidth as real
tell application "Adobe Photoshop CS6"
set display dialogs to never
set myOptions to {class:PDF open options, mode:CMYK, resolution:300, use antialias:true, page:1, constrain proportions:true, crop page:bounding box}
set jpgOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:12}
open file (thefile as text) as PDF with options myOptions
set mystate to current history state of current document
set docRef to current document
set docName to name of docRef
tell application "Finder"
set JpgFolderName to "Hi-Res JPEG_" & docName
set JpgFolder to (make new folder at parentFolder with properties {name:JpgFolderName})
set BackC to (JpgFolder as string) & docName & "_Back Cover"
set FrontC to (JpgFolder as string) & docName & "_Front Cover"
set KindleBackC to (JpgFolder as string) & docName & "_Kindle Back Cover"
set KindleFrontC to (JpgFolder as string) & docName & "_Kindle Front Cover"
end tell
resize canvas document 1 width pageWidth as inches anchor position middle left
save docRef in file BackC as JPEG with options jpgOptions with copying
tell current document
change mode to RGB
resize image height 1000 as pixels
save docRef in file KindleBackC as JPEG with options jpgOptions with copying
end tell
set current history state of current document to mystate
resize canvas document 1 width pageWidth as inches anchor position middle right
save docRef in file FrontC as JPEG with options jpgOptions with copying
tell current document
change mode to RGB
resize image height 1000 as pixels
save docRef in file KindleFrontC as JPEG with options jpgOptions with copying
end tell
close docRef without saving
end tell
end if
end repeat
end open
The original script which creates only the two JPGs:
on open theItems
-- set pageWidth to text returned of (display dialog "Enter the page width (in inches)" default answer 6)
repeat with thefile in theItems
tell application "System Events"
set {name extension:fileExtension, container:parentFolder} to thefile
set parentFolder to path of parentFolder
end tell
if fileExtension is "pdf" then
set pageWidth to text returned of (display dialog "Enter the page width (in inches)" default answer 6)
set pageWidth to pageWidth as real
tell application "Adobe Photoshop CS6"
set display dialogs to never
set myOptions to {class:PDF open options, mode:CMYK, resolution:300, use antialias:true, page:1, constrain proportions:true, crop page:bounding box}
set jpgOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:12}
open file (thefile as text) as PDF with options myOptions
set mystate to current history state of current document
set docRef to current document
set docName to name of docRef
tell application "Finder"
set JpgFolderName to "Hi-Res JPEG_" & docName
set JpgFolder to (make new folder at parentFolder with properties {name:JpgFolderName})
set BackC to (JpgFolder as string) & docName & "_Back Cover"
set FrontC to (JpgFolder as string) & docName & "_Front Cover"
end tell
resize canvas document 1 width pageWidth as inches anchor position middle left
--set jpgOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:12}
save docRef in file BackC as JPEG with options jpgOptions with copying
set current history state of current document to mystate
resize canvas document 1 width pageWidth as inches anchor position middle right
--set jpgOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:12}
save docRef in file FrontC as JPEG with options jpgOptions with copying
close docRef without saving
end tell
end if
end repeat
end open