"find" fiasco

Friedrich F. Grohmann shedrup at ms9.hinet.net
Sat Oct 22 00:18:24 EDT 2005


Jacqueline,

     Thank you so much for your kind suggestion. The problem is that even 
with your script the find results (or rather the lack thereof) appear to 
remain the same. That's a pity because it is very convenient to search 
for other instances of text directly selected in a field on the card one 
is looking at.

     Anyway, I found a workaround since, strangely enough, there is a way 
to find Chinese text which seems to work well and reliably. It requires 
an extra field with a returnInField script ("find string the text of me 
in fld ID 1003"). So now I'm putting the selectedText into that field by 
way of a button and it works.

     Same stack, same text, same "find" --yet completely different 
responses and results. Very weird, at least in my eyes.

     Thanks again for your help.

Fritz



>Friedrich F. Grohmann wrote:
>> I have a rather simple stack with text in fields on a number of cards 
>> (Rev 2.6 under Mac OS 10.3.2). The text is in Chinese. 
>> 
>> In order to look for other instances of a term found on the present card 
>> (in fld ID 1003) I'm using a "find selection" button the script of which 
>> is as follows:
>> 
>> on mouseUp
>>   put the selectedText of fld ID 1003 into SelCh
>>   go to cd "Single Line" of stack "Message Box"
>>   put "find" && quote&SelCh&quote into fld "Message Field"/
>>      of cd "Single Line" of stack "Message Box"
>>   select after text of fld "Message Field" of cd "Single Line" of stack 
>> "Message Box"
>> end mouseUp
>> 
>> I'm not sure whether there is anything wrong with this script but the 
>> following things happen:
>> 
>> 1) With some words, the first instance (on the present) card is indicated 
>> by the box and with each further hit of the return key one proceeds to 
>> the next card where the term is found.
>> 
>> 2) In the case of other words, the instance on the present card is not 
>> identified and only one other card is found, although the term actually 
>> occurs on a number of cards.
>> 
>> 3) There are still other words in case of which the response is simply 
>> "not found".
>> 
>> 4) I've run into so far one case where no instance is indicated and I am 
>> told
>> 
>>           Script compile error:
>>           Error: Script: missing "" after literal
>> 
>> 5) There was another word, where no box was drawn at all but all 
>> instances were found. 
>> 
>> This scenario is very bewildering, to say the least. Is there any mistake 
>> in the logic of the script or do I miss some other subtle detail? Any 
>> help highly appreciated.
>> 
>
>It might be a unicode problem, but I'm not sure. What happens if, 
>instead of using the message box, you use a script to find words? Make a 
>button with a script like this:
>
>on mouseUp
>  global gFindText
>  if gFindText = ""
>  then put the selectedText of fld ID 1003 into gFindText
>  find gFindText
>end mouseUp
>
>You should turn off autohiliting for the button so that the selectedtext 
>remains selected when you click.
>
>When you repeatedly click the button, do you get the same results?



More information about the use-livecode mailing list