Hi All,
I want to move all item of page 1 to page 5. For this I have developed the below script.
But I want to move all item to page 1 with their position.
Please suggest:
tell application "InDesign CS"
tell front document
move all page items of page 1 to page 5
end tell
end tell
Thanks in Advance
Rajeev
macrajeev,
Here’s what I came up with. I don’t script InDesign much and could not find an easy way to get the position of items in a page. This should move the items to another page and place them in the same position as in the first page. If you don’t reset the position of each item, InDesign places all items in the upper left corner of the page moved to. The coordinates for an odd numbered page are different than for an even page because the pages are measured from the left of the even page to the right containing both pages. Example: Left side coordinate of page 2 of a 3 page doc (US Letter) starts at 0 points. Left coordinate of page 3 starts at 612 points. Anyway here it is.
tell application "InDesign CS"
activate
tell active document
get properties of page 4
set selectionList to every page item of page 1 -- can use similar method (as below) to get different page
get geometric bounds of item 1 of selectionList
set thePage to text returned of (display dialog "Which page do you want items moved to?" default answer "2")
set thePage to thePage as number
-- determine if page to move to is odd or even
if thePage is greater than 1 and thePage mod 2 is 1 then
set pageBounds to bounds of page thePage
else
set pageBounds to bounds of page 1
end if
-- this seemed the only way to get the items in the same position as in the first page.
repeat with anItem in selectionList
set theBounds to geometric bounds of anItem
set x to ((item 2 of pageBounds) + (item 2 of theBounds))
set y to item 1 of theBounds
move anItem to page 3
set properties of anItem to {visible bounds:theBounds}
move anItem to {x, y}
end repeat
end tell
end tell
PreTech