Kirk, here is something of mine that you can have a look at and modify to suit your needs. I have put the bones of what you wanted in it. Photoshop works out the height/width part after reasterizing the file. I don't know whats in you actions but I personally try not to use them and code the whole thing this way your script will be more portable as it no longer requires actions. Hope this helps.
--
set tempFolderName to "Converted to CMYK JPEG at 300dpi"
set inputFolder to choose folder
tell application "Finder"
set filesList to (files of inputFolder whose file type is "PDF ")
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
repeat with aFile in filesList
set fileIndex to 0
tell application "Finder"
set theFile to aFile as alias
set theFileName to name of theFile
end tell
tell application "Adobe Photoshop CS"
set display dialogs to never
set UserPrefs to properties of settings -- Record user settings
set ruler units of settings to cm units -- to be used for the canvas resize, remove if NOT required…
set background color to {class:RGB color, red:255, green:255, blue:255}
open theFile as PDF with options {class:PDF open options, mode:CMYK, resolution:300, use antialias:true, constrain proportions:true}
set docRef to the current document
tell the current document
set docHeight to height of docRef -- to be used for the canvas resize, remove if NOT required…
set docWidth to width of docRef -- to be used for the canvas resize, remove if NOT required…
flatten
-- this line below cuts OFF the 1cm to all edges around my print PDF's
-- removing bleed and registration marks, remove if NOT required…
resize canvas width (docWidth - 2) height (docHeight - 2)
if (docHeight > docWidth) then
do action "Your Action 1" from "Your Set" -- Note this is case sensitive.
else
do action "Your Action 2" from "Your Set" -- Note this is case sensitive.
end if
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
set newFileName to (outputFolder as string) & docBaseName
end tell
set ruler units of settings to ruler units of UserPrefs -- Reset changed user settings
save docRef in file newFileName as JPEG with options ¬
{class:JPEG save options, embed color profile:true, format options:optimized, matte:background color matte, quality:9} appending lowercase extension with copying
close current document without saving
end tell
end repeat
on getBaseName(fName)
set baseName to fName
repeat with idx from 1 to (length of fName)
if (item idx of fName = ".") then
set baseName to (items 1 thru (idx - 1) of fName) as string
exit repeat
end if
end repeat
return baseName
end getBaseName
--