Re: InDesign - reference/select items that are pasted inside another text frame
Re: InDesign - reference/select items that are pasted inside another text frame
- Subject: Re: InDesign - reference/select items that are pasted inside another text frame
- From: Steven Mills via AppleScript-Users <email@hidden>
- Date: Mon, 3 Oct 2022 11:12:20 -0500
On Oct 3, 2022, at 09:49:04, Bert Groeneveld via AppleScript-Users
<email@hidden> wrote:
>
> Hi, I have a multipage InDesign document containing many text frames that
> have another text frame pasted inside iself.
> I want to clean that up. I need (help with) a script that references/selects
> the text frame that is pasted inside (it’s parent text frame), cuts it and
> pastes in in place and finally remove the parent text frame.
> Can that be done using an applescript?
>
> See also attached screendump.
>
> tell application "Adobe InDesign 2022"
> set mySelection to selection -- mutiple text frames selected
> repeat with i from 1 to count of mySelection
> tell item i of mySelection
> -- how do I reference/select the small text frame that
> is pasted inside item i of mySelection? Cut it and paste it in place and
> finally remove item i of mySelection (which is the containing text frame)
> end tell
> end repeat
> end tell
If you want to do it like you say, with cut and paste, that's simple:
tell application "Adobe InDesign 2022"
cut
paste in place
end tell
But be warned that "in place" might not be the place you think it will be. To
do this the right way, I'd first save the parent page item reference:
set theParent to parent of i
if class of theParent is character or class of theParent is text then
set theFrames to parent text frames of theParent
set outerItem to item 1 of theFrames
else
set outerItem to theParent
end if
move i to <something>
delete outerItem
Due to Adobe's goofy way of supporting AppleScript, I can't figure out the
correct target for the move event. You should be able to simply move it to the
page or spread that owns outerItem, but that does nothing. Not even an error.
Maybe someone else can supply that part.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden