NISUS Archives

April 2017

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Sat, 22 Apr 2017 15:02:24 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (28 lines)
> On 2017/04/22, at 13:46, Nobumi Iyanaga <[log in to unmask]> wrote:
> 
> I removed these "where" options, but now, the macro stops at the line:
> 
> 		$text.transliterateInRange($sel.range, $map)
> 
> saying that:
> 
> The given character index (37002) is out of bounds fot the Text object (length 35039).
> 

Ah, sorry, my macro for testing was somewhat too simplified. 

>> 	$sels = $doc.text.findAll '\p{Han}+', 'E', '-am'
>> 	foreach $sel in $sels
>> 		$text.transliterateInRange($sel.range, $map)
>> 	end

It is necessary to use $sel.text instead of $text which is the main body text and does not work for $sel in other text objects. So the following would work correctly:

	$sels = $doc.text.findAll '\p{Han}+', 'E'
	foreach $sel in $sels
		$sel.text.transliterateInRange($sel.range, $map)
	end


Kino

ATOM RSS1 RSS2