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: Nick Passmore via AppleScript-Users <email@hidden>
- Date: Tue, 4 Oct 2022 09:43:31 +0100
I think this may do what you want.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application id "com.adobe.InDesign"
tell document 1
set AllPageItems to (all page items)
repeat with f from 1 to count of items of AllPageItems
set NextPageItem to (item f of AllPageItems)
select NextPageItem
delay 0.1
try
set ParentStory to parent story of NextPageItem
set ParentFrame to (item 1 of (parent text
frames of parent of NextPageItem))
set PosAcross to (item 2 of geometric bounds of
ParentFrame)
set PosDown to (item 1 of geometric bounds of
ParentFrame)
MakeCut() of me
delay 0.1
select ParentFrame
DoDelete() of me
delay 0.1
DoPaste() of me
move selection to {PosAcross, PosDown}
on error ErrorText
log ErrorText
end try
end repeat
end tell
end tell
on MakeCut()
tell application id "com.adobe.InDesign"
cut
end tell
end MakeCut
on DoPaste()
tell application id "com.adobe.InDesign"
paste
end tell
end DoPaste
on DoDelete()
tell application id "com.adobe.InDesign"
delete selection
end tell
end DoDelete
> On 3 Oct 2022, at 15:49, 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
> <Screenshot 2022-10-03 at 16.35.44.png>
> _______________________________________________
> 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
_______________________________________________
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