InDesign: Group Selected Items

Item # 1
I basically want to select all items on a document, group them, copy the grouping, close and paste into another document (which is currently open).
Can someone please tell me what is wrong with this code? I get “InDesign got an error: Can’t make class group.”

tell application "InDesign"
	set mySel to every page item of document 1
	set myGroup to make group with data mySel
	copy
	close document 1 saving yes
	paste
end tell

I’m working in InDesign 2 not CS (don’t know if that matters or not)

Item #2
Also, on occasion, when I open a document I get a warning: “The text has been automatically updated. Please verify proper text placement.” Is there a way to determine if this dialog box is present and ignore it?

Thanks - slimjim5811

Hi slimjim5811

Try this for grouping-copying page items

tell application “InDesign”
set theGroup to make group with properties {group items:page items}
copy theGroup
close document 1 saving yes
paste
end tell

(un tested)
Budgie

Budgie - Thanks for your suggestion, but I still get: “InDesign got an error: Can’t make class group.”
I tried to reference Document1 in the tell block like this:

tell document 1 of application "InDesign"
	set theGroup to make group with properties {group items:page items}
	copy theGroup
	close document 1 saving yes
	paste
end tell

but it gives me: “InDesign got an error: Some parameter is missing for make.”
In a desparate attempt, I even tried going the “System Events/keystroke “g” using command down” route, but for some reason, it was performing the keystroke in Script Editor.
What a headache this gives me.
slimjim5811

give this a go slimjim5811, it works for me for Adobe InDesign CS2, not sure of earlier versions of ID CS though.

tell application “Adobe InDesign CS2”
set mySpread to spread 1 of active document
tell mySpread
set theGroup to make group with properties {group items:page items}
end tell
end tell

Budgie

No good Budgie-
“InDesign got an error: Some parameter is missing for make.”

It must be something that InDesign 2 doesn’t like. :frowning:

try these two posts, I found them really informative, probably suit your version of ID, the second post
gives a good description of the changes of grouping in cs and ID2, hope it helps

http://www.google.com/search?client=safari&rls=en&q=make+group+indesign+applescript&ie=UTF-8&oe=UTF-8

http://www.scriptingmatters.com/indesigncs_changes.php

Budgie

sorry dont worry about the top web site

try this one,

http://olivier.berquin.free.fr/indesign/frame_indy.html

Budgie

Budgie -
thanks for the links. http://olivier.berquin.free.fr/indesign/frame_indy.html helped me out a great deal. Here’s my final AS:

tell application "InDesign"
	set mySel to every page item of document 1
	if (count of mySel) > 1 then
		set myGroup to make group at parent of item 1 of mySel with data mySel
		select myGroup
		copy
	else
		select mySel
		copy
	end if
	close document 1 saving no
	paste
end tell

thanks again for your help!
slimjim5811