"find" fiasco

J. Landman Gay jacque at hyperactivesw.com
Thu Oct 20 20:36:37 EDT 2005


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?

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list