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: Bert Groeneveld via AppleScript-Users <email@hidden>
- Date: Fri, 07 Oct 2022 15:52:02 +0200
Thanks everybody for the input. Finally this did the job:
tell application "Adobe InDesign 2022"
set mySelection to selection -- mutiple text frames selected
repeat with aSelection in mySelection
try
tell aSelection
if class of aSelection ≠ group then
try
set Kleurnummertje to text
frame 1
on error
set Kleurnummertje to rectangle
1
end try
tell application "Adobe InDesign 2022"
to select Kleurnummertje
tell application "Adobe InDesign 2022"
to cut Kleurnummertje
delete aSelection
tell application "Adobe InDesign 2022"
to paste in place
end if
end tell
end try
end repeat
end tell
> On 4 Oct 2022 - wk 40, at 10:43, Nick Passmore via AppleScript-Users
> <email@hidden> wrote:
>
> 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
>> <mailto: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
>> <mailto:email@hidden>)
>> Help/Unsubscribe/Update your Subscription:
>>
>> Archives: http://lists.apple.com/archives/applescript-users
>> <http://lists.apple.com/archives/applescript-users>
>>
>> This email sent to email@hidden <mailto:email@hidden>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden
> <mailto:email@hidden>)
> Help/Unsubscribe/Update your Subscription:
>
> Archives: http://lists.apple.com/archives/applescript-users
> <http://lists.apple.com/archives/applescript-users>
>
> This email sent to email@hidden
> <mailto: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