Hello there:
Working on a InDesign CS3 application:
-- Drop files on app
-- Opens template chosen by user
-- Each file is placed on page duplicated from original
-- Eventually: export each page individually to a PDF file named using original file name
on open theseAds
set EOY_Proof_Template to choose file with prompt "Please select your End of Year Proof Template:" without invisibles
tell application "Adobe InDesign CS3"
open EOY_Proof_Template
repeat with thisAd in theseAds
try
set myPage to (duplicate page 1 of document 1)
tell application "Adobe InDesign CS3"
tell rectangle 1 of page 1 of document 1
place thisAd as string
tell application "System Events"
tell process "Adobe InDesign CS3"
set frontmost to true
keystroke "e" using shift down & command down
end tell
end tell
end tell
end tell
on error the error_message number the error_number
display dialog "ERROR: " & the error_number & ". " & the error_message buttons ("OK")
end try
end repeat
end tell
end open
Files place fine but I’m having trouble with the System Events command that is supposed to center the image in the frame. Any ideas?
This works in CS4, probably CS3 as well (see 2 lines after ‘place thisAd as string’}:
-- Drop files on app
-- Opens template chosen by user
-- Each file is placed on page duplicated from original
-- Eventually: export each page individually to a PDF file named using original file name
on open theseAds
set EOY_Proof_Template to choose file with prompt "Please select your End of Year Proof Template:" without invisibles
tell application "Adobe InDesign CS3"
open EOY_Proof_Template
repeat with thisAd in theseAds
try
set myPage to (duplicate page 1 of document 1)
tell application "Adobe InDesign CS3"
tell rectangle 1 of page 1 of document 1
place thisAd as string
set myImage to rectangle 1 of page 1 of document 1
fit myImage given center content
tell application "System Events"
tell process "Adobe InDesign CS3"
set frontmost to true
keystroke "e" using shift down & command down
end tell
end tell
end tell
end tell
on error the error_message number the error_number
display dialog "ERROR: " & the error_number & ". " & the error_message buttons ("OK")
end try
end repeat
end tell
end open