> Nicolas R Cueto <[EMAIL PROTECTED]> asked.
>
> Hello.
>
> When a user clicks on a word in a sentence (not a cr-line but a
> grammatical sentence), how could I find out the number of that sentence?
> I'd like to create sound files for each of the sentences in a paragraph,
> and then label each sound file with a corresponding number. For example,
> I'd want sound file "2.au" to be played when the user clicks anywhere
> within the second sentence of this paragraph:
>
> This is the first sentence. "However this," she said,
> "is the second sentence." Is this, then, the third sentence?
>
> I've consulted clickChunk, clickChar, etc., and thought about playing
> with the itemDelimiter (there's no such thing as a lineDelimiter, is
> there?) but can't figure out anything, elegant or ugly.
>
> Thank you in advance.
>
> --
> Nicolas R Cueto
> Takakura JHS/SHS
> Nagoya, Japan
>
I have a suggestion. You can group the text. Here is a little handler I made
up.
on mouseUp
put 1 into x
repeat with i = 1 to -1+the number of words in char 1 to word 2 of
clickcharchunk() of me
if "group" is not in the textstyle of word i to i+1 of me then add 1 to
x
end repeat
answer x
end mouseUp
This should allow you to get the group. Be sure you have a space after each
sentence, even when you put in a different paragraph. Also be careful not to
include that space in the grouped text.
The next handler is admittedly messy, but it did the job in my field without
resorting to grouped text.
on mouseUp
put 1 into x
repeat with i = 1 to -1+the number of words in char 1 to word 2 of
clickcharchunk() of me
if char -1 of word i of me is in ".!" or (char -1 of word i of me is
quote \
and (char -2 of word i of me is "." or (char -2 of word i of me is
"!" and \
chartonum(char 1 of word(i+1) of me)<97))) then add 1 to x
end repeat
answer x
end mouseUp
I may have forgotten some punctuation marks that delimit sentences, but I
hope this helps. If you clean this up, please post it!
Hope this helps,
Raymond
This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm