I recently upgraded a few users to CS5.5 from CS4 and found out an applescript running in Filemaker no longer works with InDesign 5.5.
Any help is greatly appreciated.
Thanks,
Mike
Original Script below: ( I only changed the line "tell application “Adobe InDesign CS4” to be "tell application “Adobe InDesign CS5.5”)
property imgNotFound : "Client_Images_01:zPageBuilder:Bugs:ImageNotFound.eps" -- MAKE FILE NOT FOUND EPS
tell application "Adobe InDesign CS4"
tell document 1
if not (layer "Images" exists) then make layer with properties {name:"Images"}
if not (layer "Hide" exists) then make layer with properties {name:"Hide"}
end tell
end tell
tell application "FileMaker Pro Advanced"
tell current record
set pBox to "p" & (cell "gt_Position" as string) as string
set tBox to "t" & (cell "gt_Position" as string) as string
set imgFileName1 to cell "gt_Place_Image1" as string
set imgFileName2 to cell "gt_Place_Image2" as string
set imgFileName3 to cell "gt_Place_Image3" as string
if imgFileName1 is not "" then
set staggerAmount to cell "gt_Place_Image_Stagger" as real
set staggerAmount to (staggerAmount + 0.25) as real
set cell "gt_Place_Image_Stagger" to staggerAmount
set imgFilePath1 to getFilePath(imgFileName1) of me
if imgFilePath1 is not "" then placeImage(pBox, imgFilePath1, "1", staggerAmount, tBox) of me
end if
if imgFileName2 is not "" then
set staggerAmount to cell "gt_Place_Image_Stagger" as real
set staggerAmount to (staggerAmount + 0.25) as real
set imgFilePath2 to getFilePath(imgFileName2) of me
if imgFilePath2 is not "" then placeImage(pBox, imgFilePath2, "2", staggerAmount, tBox) of me
end if
if imgFileName3 is not "" then
set staggerAmount to cell "gt_Place_Image_Stagger" as real
set staggerAmount to (staggerAmount + 0.25) as real
set imgFilePath3 to getFilePath(imgFileName3) of me
if imgFilePath3 is not "" then placeImage(pBox, imgFilePath3, "3", staggerAmount, tBox) of me
end if
end tell
end tell
--PLACE IN INDESIGN DOC
on placeImage(pBox, imgFilePath, imgCount, staggerAmount, tBox)
tell application "Adobe InDesign CS4"
activate
tell document 1
set pBoxRef to page item pBox
move page item pBox to layer "Hide"
set newBox to duplicate pBoxRef
set label of newBox to (pBox & "_" & imgCount as string)
place imgFilePath on newBox
fit item 1 of newBox given proportionally
fit item 1 of newBox given center content
move newBox to layer "Images"
set theBounds to geometric bounds of pBox as list
try
set bnd1 to item 1 of theBounds as real
set bnd2 to item 2 of theBounds as real
set bnd3 to item 3 of theBounds as real
set bnd4 to item 4 of theBounds as real
on error
set bnd1 to 0
set bnd2 to 0
set bnd3 to 0
set bnd4 to 0
end try
if bnd1 ≠0 then
set newBnd1 to bnd1 + staggerAmount
set newBnd2 to bnd2 + staggerAmount
set newBnd3 to bnd3 + staggerAmount
set newBnd4 to bnd4 + staggerAmount
set newBounds to {newBnd1, newBnd2, newBnd3, newBnd4} as list
set geometric bounds of page item pBox to newBounds
end if
end tell
end tell
end placeImage
--GET IMAGE PATH
on getFilePath(imgFileName)
set imgFilePath to "Sears_Images_01:"
set imgFolderName to characters 2 thru -1 of imgFileName as string
set imgFolderName to ((round (imgFolderName / 200) rounding down) as string) * 200 as string
set imgFolderName to characters -1 thru -6 of ("000000" & imgFolderName as string) as string
set imgFilePath to imgFilePath & "s" & imgFolderName & ":" & imgFileName & ".eps" as string
tell application "Finder"
if file imgFilePath exists then
return imgFilePath
else if file imgNotFound exists then
return imgNotFound
else
return ""
end if
end tell
end getFilePath