Copy link to clipboard
Copied
I've encountered a rather puzzling scripting challenge with Adobe InDesign CC 2023. I hope someone might have come across a similar issue and could offer insights or solutions.
Background:
I'm using AppleScript to automate a workflow in InDesign. The primary goal is to copy a grouped object (2 inches x 4 inches which contains two TIFF images) from one document, and then paste it into a specific InDesign template. After this, I intend to save and export the new document as a PDF.
Issue:
Everything runs smoothly with the script, except for one major problem: the TIFF images, after being duplicated into the new document, are not visible on the page. Oddly enough, they are still present in the Links panel, and no warnings or issues are indicated there. I've checked typical suspects like layering, object styles, and visibility settings, but everything seems in order. Additionally:
What I've Tried:
None of these resolved the issue.
I worked closely with an expert to troubleshoot this, but we're a bit stumped. It seems like a peculiar behavior specific to AppleScript's interaction with InDesign, or perhaps something about my particular InDesign setup or the TIFF images themselves.
Request:
Has anyone encountered a similar issue with AppleScript and InDesign, particularly regarding image visibility after scripted duplication? I'd be grateful for any insights, suggestions, or alternative approaches.
Thank you in advance for your help!
Copy link to clipboard
Copied
Hi @jeffpim , rather than getting and setting the groups’s geometric bounds, try using the move method. For example this would move a selected group (duplicatedItem in your code) and its page items to 0,0
tell application id "com.adobe.indesign"
tell active document
set ruler origin of view preferences to page origin
set zero point to {0.0, 0.0}
set s to item 1 of selection
move s to {0, 0}
end tell
end tell
Before and after:
Copy link to clipboard
Copied
Rob,
Your solution worked great! Thanks so much!
Jeff
The updated code is below:
tell application "Adobe InDesign CC 2023"
-- Assuming you have a grouped object selected in your current document
set myDoc to active document
set selectedItem to selection
if (count of selectedItem) is equal to 0 then
display dialog "Please select a grouped item in the document." buttons {"OK"} default button "OK"
return
end if
-- Open specific InDesign template file
set templatePath to "Macintosh HD:Users:Username:import.indt"
set templateDoc to open templatePath
-- Duplicate the selected item to the new document
set duplicatedItem to duplicate selectedItem to beginning of page 1 of templateDoc
-- Move the duplicated item to {0, 0} (Top-left corner)
tell templateDoc
set ruler origin of view preferences to page origin
set zero point to {0.0, 0.0}
set s to item 1 of duplicatedItem
move s to {0, 0}
end tell
-- Save-as the document
set saveName to "Macintosh HD:Users:Username:import.indd"
save templateDoc to saveName
-- Export as PDF
set pdfPath to "Macintosh HD:Users:Username:import.pdf"
export templateDoc format PDF type to pdfPath without showing options
-- Close the template document without saving further changes