Folks
I’ve been trying to ungroup a series of page elements using System Events. When I test the individual code snippet, it works, but when I embedd it in the entire script, it doesn’t work.
tell application "Adobe InDesign CS2"
select every page item of the page 5 of active document
tell application "System Events" to keystroke "g" using command down & shift down
end tell
I’ve controlled for being embedded in a handler. All I can think is that either the document isn’t really ‘active’ or that the system is busy elsewhere?
thanks,
Ralph
Hi Ralph,
the safest way to send menu keystrokes
is to activate the application explicitly and target also the process
tell application "Adobe InDesign CS2"
select every page item of the page 5 of active document
activate
tell application "System Events" to tell process "Adobe InDesign CS2" to keystroke "g" using {command down, shift down}
end tell
PS: Indesign has a ungroup command
Thanks Stefan-
I did indeed try to use the ungroup command before attempting the last resort of System Events. I tried
select every page item of the page 5 of active document
ungroup page item
and
tell application "Adobe InDesign CS2"
ungroup every page item of the page 5 of active document
end tell
and several other permutations…
I am not sure what you mean by
stumped,
Ralph
the direct parameter of ungroup must be a group so it’s something like this
tell application "Adobe InDesign CS2"
tell active document
set a to page items of page 1 whose class is group
repeat with i in a
ungroup i
end repeat
end tell
end tell
just look at the differences between your a my script
My goodness- that works great!
thanks Stefan!
-Ralph