Hi
I’m trying to copy content from one page to another document and then move in to position.
I’m make the script below (sorry, but not the most elegant) and sometimes it works and sometimes it doesn’t.
Basic Process should be:
- select doc 1
 - select all items on page X and group
 - copy items
 - select doc 2
 - paste items
 - move to position
 - ungroup
 - repeat with next page
 
If anyone can help please ![]()
thanks
Shane
tell application "Adobe InDesign 2022"
	activate
	set active document to document "donor-doc-1.indd"
	--
	tell document "donor-doc-1.indd"
		select all page items of page 1
	end tell
	--
	delay 0.25
	-- group
	tell application "System Events"
		key code 5 using command down
	end tell
	--
	copy
	delay 0.25
	set active document to document "final-doc-2.indd"
	--
	--Select page
	tell application "System Events"
		-- Apple J
		key code 38 using command down
		delay 0.25
		-- page 3
		key code 21
		delay 0.25
		-- Hit Enter
		key code 76
	end tell
	--
	delay 0.25
	--
	paste
	--
	delay 0.25
	move selection to {10, 10}
	--
	--ungroup
	tell application "System Events"
		key code 5 using {shift down, command down}
	end tell
	--
	--
	delay 0.25
	-- select none
	tell application "System Events"
		key code 0 using shift down
	end tell
	--
	--//////////// Copy & Paste from page 2 of donor doc
	--
	set active document to document "donor-doc-1.indd"
	--
	tell document "donor-doc-1.indd"
		select all page items of page 2
	end tell
	--	
	delay 0.25
	-- group
	tell application "System Events"
		key code 5 using command down
	end tell
	--
	--
	copy
	delay 0.25
	set active document to document "final-doc-2.indd"
	--
	--Select page
	tell application "System Events"
		-- Apple J
		key code 38 using command down
		delay 0.25
		--page 2 (nbut it doesn't see this as page 2 and just pasts it on page 1)
		key code 19
		delay 0.25
		-- Hit Enter
		key code 76
	end tell
	--
	delay 0.25
	--
	paste
	--
	delay 0.25
	move selection to {10, 100}
	--
	--
	--ungroup
	tell application "System Events"
		key code 5 using {shift down, command down}
	end tell
	--
	--
	delay 0.25
	-- select none
	tell application "System Events"
		key code 0 using shift down
	end tell
end tell