Re: Sv: InDesign TOC and overflowing text questions
Re: Sv: InDesign TOC and overflowing text questions
- Subject: Re: Sv: InDesign TOC and overflowing text questions
- From: EBI Aktivitet <email@hidden>
- Date: Tue, 12 Oct 2004 13:51:34 +0200
Thanks Richard, you saved my day! :-)
I enclose a slightly modified version of your script, that should work with
all language version. Maybe it's useful for anyone else who runs into the
same bug...
Thanks to every one who helped out on my two ID issues!
Regards, Adim
----Script---
--Work around script for updating table of content in InDesign CS.
--Should work with all language versions.
tell application "InDesign CS"
activate
--make sure the text frame where the TOC to update resides is selected
select text frame 3 of page 2 of active document
end tell
tell application "System Events"
tell process "InDesign CS"
tell menu bar 1
tell menu bar item 5 --tell menu bar item "Layout"
tell menu 1 --tell menu "Layout"
click menu item 19 --menu item "Update TOC"
end tell
end tell
end tell
end tell
end tell
Den 04-10-12 06.55, skrev "Richard Rönnbäck"
<email@hidden>:
> Hi Adim!
>
> As Courtney says, the TOC scripting is badly broken.
>
> The only workaround, is to use of GUI scripting
>
> http://www.apple.com/applescript/uiscripting/index.html
>
> A sample snippet for InDesign CS (Swedish version) goes like the one below.
> Beware for line breaks, and make sure the menu names matches your language
> version, or else it will fail. I have tried to indicate the English menu
> names, but that is from memory, so please double check
>
> If you have trouble getting it to work, feel free to give me a call, my
> number is in the directory
>
> Richard Rönnbäck
>
>
>
> tell application "InDesign CS"
> activate
> --make sure the insertion point is in the text frame where the TOC to
> update resides
> set selection to (insertion point 1 of text frame 1 of page 1 of active
> document)
> end tell
> tell application "System Events"
> tell process "InDesign CS"
> tell menu bar 1
> tell menu bar item "Sida" --should be "Page" in the English
> version
> tell menu "Sida" --should be "Page" in the English version
> click menu item "Uppdatera innehållsförteckning"
> --should be "Update TOC" in the English version
> end tell
> end tell
> end tell
> end tell
> end tell
>
>
>
>
>
>
>
>
>> Från: Courtney Schwartz <email@hidden>
>> Datum: Mon, 11 Oct 2004 16:55:08 -0400
>> Till: Applescript - Users <email@hidden>
>> Ämne: Re: InDesign TOC and overflowing text questions
>>
>>
>> On Oct 11, 2004, at 4:41 PM, EBI Aktivitet wrote:
>>
>>> Two problems...
>>>
>>> 1. Table Of Contents suddenly not working, and it used to be working
>>> fine.
>>> InDesign will quit when I run this code, and I can't make out what's
>>> wrong.
>>> In the document there is a TOC already, I just want to update it. I've
>>> tried
>>> rebuilding the TOC style, and also the entire document template, just
>>> to
>>> avoid getting stuck in a corrupt doc, but no success.
>>
>> Had a lot of this problem recently.
>>
>> There is a known bug where create TOC in InDesign CS is broken...
>> literally, can't be gotten around, as it returns the wrong data type.
>>
>> You can get around this if you want by taking an old InDesign 2 script
>> that creates some text based upon styles present in the document.
>> Klugey, but the only way until Adobe fixes that part of the software.
>>
>> Search Adobe's InDesign Scripting forum for details.
>>
>>>
>>> 2. I want to place text in a text frame, but the text might be longer
>>> than
>>> what the text frame visibly can contain. Each line is added as a
>>> separate
>>> paragraph, but when the lines hit the last visible boundary of the text
>>> frame, and starts adding outside the visible bounds, the text goes
>>> crazy. It
>>> seems that insertion point -1 is not the right way to do this, when
>>> the text
>>> overflows. It seems that insertion point -1 is referenced from the
>>> visible
>>> insertion point, not the actual last text, so all text is added in
>>> reverse
>>> as soon as it hits the visible bounds. Any suggestions greatly
>>> appreciated.
>>
>> Yeah, try something more like this:
>>
>> set myString to "Something to type."
>> tell application "InDesign CS"
>> tell active document
>> tell page 1
>> tell text frame 1
>> set contents of insertion point 1 to myString
>> // You can set more contents, it will append (although, append
>> before, instead of after, myString).
>> end tell
>> end tell
>> end tell
>> end tell
>>
>> which works for me.
>> _______________________
>>
>> Courtney Schwartz
>>
>> Documentation Specialist
>> Global Technology Associates
>> 3505 Lake Lynda Dr. Suite 109
>> Orlando, FL 32817 USA
>> (407) 380-0220 x1427
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Applescript-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
r
>> edband.net
>>
>> 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:
>
> 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:
This email sent to email@hidden