I need to change the top left (x,y) coordinates of a text frame in 7000 Indesign docs
All these docs haven only one text frame, some of them are locked - have to be unlocked
This is what I want:
Choose folder
Tell Indesign CS3 open doc
Check for ‘locked’ - if then ‘unlock’
Set top left coordinates of text frame to x=40 y=70
Save the doc in a subfolder of choosen folder (Done)
Continue when whatever error
This should work - you just need to build in the repeat loop to step it through a batch of files.
tell application "Adobe InDesign CS3"
set properties of view preferences to {horizontal measurement units:inches, vertical measurement units:inches, ruler origin:page origin}
set transform reference point of layout window 1 to top left anchor
set myDoc to document 1
tell myDoc
try
set myBox to text frame 1 of page 1
set properties of myBox to {locked:false}
move myBox to {1, 1} -- sets the x,y of top left corner to 1 inch, 1 inch
on error
--do something amusing
end try
end tell
end tell
I’m trying to finish the script but it will not save and close the active document.
I must be doing something wrong but I can’t figure out what the problem is:
set processFolder to choose folder with prompt "Choose a folder that contains Innd Docs to process"
tell application "Finder"
if not (exists folder "OUT" of processFolder) then
make new folder at processFolder with properties {name:"OUT"}
end if
set the destination_folder to folder "OUT" of processFolder as alias
end tell
tell application "Finder"
try
set listFiles to (files of contents of processFolder) as alias list
on error
set listFiles to (files of contents of processFolder) as alias as list
end try
repeat with thisFile in listFiles
tell application "Adobe InDesign CS3"
with timeout of 120 seconds
activate
set properties of view preferences to {horizontal measurement units:millimeters, vertical measurement units:millimeters, ruler origin:page origin}
open thisFile
set transform reference point of layout window 1 to top left anchor
set myDoc to document 1
set docName to name of document 1
tell myDoc
try
set myBox to text frame 1 of page 1
set properties of myBox to {locked:false}
move myBox to {60, 60} -- sets the x,y of top left corner to 20 millimeters, 40 millimeters
save document 1 to (destination_folder & docName)
close document 1 without saving
end try
end tell
end timeout
end tell
end repeat
end tell
Thanks for the input.
I solved it.
Maybe quick and dirty but it works - If there is a better way please let me know
One question more:
How do I let Indesign when opening a document not checking (or ignoring) for missing links.
This is important because it stops the script;
set processFolder to choose folder with prompt "Choose a folder that contains Innd Docs to process"
tell application "Finder"
if not (exists folder "OUT" of processFolder) then
make new folder at processFolder with properties {name:"OUT"}
end if
set the destination_folder to folder "OUT" of processFolder as alias
end tell
tell application "Finder"
try
set listFiles to (files of contents of processFolder) as alias list
on error
set listFiles to (files of contents of processFolder) as alias as list
end try
repeat with thisFile in listFiles
tell application "Adobe InDesign CS3"
with timeout of 120 seconds
activate
set properties of view preferences to {horizontal measurement units:millimeters, vertical measurement units:millimeters, ruler origin:page origin}
open thisFile
set transform reference point of layout window 1 to top left anchor
set docName to name
tell active document
try
set myBox to text frame 1 of page 1
set properties of myBox to {locked:false}
move myBox to {60, 60} -- sets the x,y of top left corner to 20 millimeters, 40 millimeters
end try
set newFileName to (destination_folder as string) & docName
--save active document
close saving yes
tell application "Finder" to move thisFile to destination_folder with replacing
end tell
end timeout
end tell
end repeat
end tell
I just tried that but I get an applescript error “Adobe Indesign error: not able to set user interaction level to never interact”
It’s not the exact error, i had to translate it fro Dutch to English.
There must be another way to ignore missing links.
How about if the document window is not displayed?
tell application "Adobe InDesign CS3"
open thisFile without showing window
I looked in the ID library for a way that works like Quark, which is to use the additional parameters of the ‘open’ command (do auto picture import yes/no/ask), but the only one there for ID is ‘showing window [boolean]’ and I can’t test whether that suppresses all interaction dialogs or just the document window display.
If that’s not the way, then setting a preference to not auto update links or even ask about links - tho I can’t be certain about that in application or document preferences. There’s something called ‘alert missing images’ in the Preferences Suite, but I have no idea how it’s used.
I tried it but it doesn’t work, failed on the next line - set transform reference point of layout window 1 to top left anchor
The missing links thing is not an option one can turn of/on in preferences - does anyone have asolution?