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?
tell application “InDesign”
set theGroup to make group with properties {group items:page items}
copy theGroup
close document 1 saving yes
paste
end tell
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
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
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