Hello Philip,
Thank you very much again for your kind help! This works very well.
I just found that I need another functionality: that is, a text can be indexed in multiple index styles, and these texts must be found as well...
I think "$doc.textIndexStyleNames" should be used, but how...??
Thank you so much again.
Best regard,
Nobumi Iyanaga
Tokyo,
Japan
> On Apr 13, 2016, at 12:31 AM, spaelti <[log in to unmask]> wrote:
>
> Hello again,
>
> Here is a macro which should do this, I think:
>
> # Macro Select Next Multiply Indexed Item
>
> $doc = Document.active
> $indexStyles = $doc.textIndexStyleNames
>
> # Get the name of the index style
> $indexName = Active Text Index Name
>
> # Go through the document and look for indexed items
> $sel = TextSelection.active
> $loc = $sel.bound
> $txt = $sel.text
>
> while $loc < $txt.length
> $attr = $txt.attributesAtIndex $loc
> $range = $txt.rangeOfAttributesAtIndex $loc
> $topic = $attr.textIndexTopicsForStyleName($indexName)
> # If an indexed item is found, check if it is multiply
> # indexed and if so, select it and quit
> if Defined $topic
> if $topic.count > 1
> $indexed = TextSelection.new $txt, $range
> $doc.setSelection $indexed
> Prompt $indexed.substring, 'Indexed as :' & $topic
> Exit
> end
> end
> $loc = $range.bound
> end
>
> # If nothing is found
> Prompt 'No indexed items found.'
>
> # end of macro
>
> best
> Philip
>
>
>> On Apr 12, 2016, at 17:32 , Nobumi Iyanaga <[log in to unmask]> wrote:
>>
>> Hello all,
>>
>> Another macro I would need is one which would find the next text in a document which is indexed with more than one "topic" (any topics). Is such a macro possible to create?
>>
>> I would be very grateful to anyone (Philip, perhaps??) who would write a macro for this purpose.
>>
>> Best regard,
>>
>> Nobumi Iyanaga
>> Tokyo,
>> Japan
>
> Philip Spaelti
> [log in to unmask]
>
>
>
>
>
|