request for script or stack
Sarah Reichelt
sarahr at genesearch.com.au
Thu Jul 28 22:14:21 EDT 2005
> Your find script works really well! It doesn't cycle through the
> same page when there's more than one hit on the same page. That's
> great! Scrolling fields will scroll to show the hit. Scrolling
> fields containing multiple hits will scroll to show multiple hits,
> if necessary. This is almost perfect!
Thanks.
>
> It seems like this ought to be native to Rev. It's silly that it
> has to be scripted. Is that an enhancement request that's already
> been submitted?
>
> I don't quite understand how your script works yet -- I'm kind of
> slow at that -- but I'll study it and figure it out.
>
> If I could wish for one enhancement, the script would scroll a
> scrolling background so I could see the hit if it were otherwise
> scrolled out of sight. I'm not asking you to script that for me. Is
> it scriptable? If so, could you drop me a hint?
After the find command has done, check "the foundChunk" and see what
it gives you. You could select it, which would automatically set the
scroll. Or you could work out which line it is and set the vScroll of
the field, but that might be tricky if the text is wrapping.
>
> Regarding the find and replace window, it sounds like yours works a
> zillion times faster than mine. Any ideas about why that could be?
> My computer isn't a screamer. It's a 466 mhz G4.
Mine's a 700 MHz G4, so it shouldn't be vastly different. And you
have more RAM than me, so that isn't it either. Sorry, I'm stumped.
The only suggestion I have is to make sure you are limiting your
searches to a specific stack and only one one aspect e.g. fields or
scripts. Do you have any of the check boxes on the left checked? I
never use them and I guess turning on "Case sensitive" could slow
things down.
Checking through the Find script used by Rev, it uses either a
matchText function (if you selected RegEx) or a simple "if myString
is in ..." to find stuff. However it also uses a technique that I
hadn't come across before but looks very useful:
set allowInterrupts to false -- this stops people interrupting
the script whenever they like
periodically, check "the interrupt" which tells you if someone
has tried to interrupt the script. This allows you to handle
interruptions gracefully and only when you want to.
However, the Find script checks this once for each object that it
searches so it seems really weird if it is taking 10 - 15 seconds per
object.
Sorry not to be more helpful,
Sarah
More information about the use-livecode
mailing list