Restricting 'Find' to just one card
Posted: Tue Feb 20, 2007 2:49 pm
I just received a lot of help from the folks using the chatrev client in working out how to restrict the find to just one card. It is actually quite simple (thanks to Mark Schonewille for this really simple solution):
Other users on the chatrev suggested using offset functions, but I found it quite tricky to get those to work as well as the above solution.
In the list archives I came across solutions that involved looping over all the cards in the stack and setting the dontSearch to true, then setting the dontSearch of the current card to false. Whilst people on the list seemed to have no problem with this, I found it only worked sporadically and difficult to debug (could have been my fault - maybe I was missing something).
Looking through my old "Hypertalk 2.2" book, it looks like one ought to be able to do "find ... on marked cards", but I couldn't get that to work in Rev 2.7.4.
Anyway, I thought I'd just post this info here, in case someone in the future is searching for a simple way to restrict a Find to just one card.
Bernard
Code: Select all
on findOnCard
put field "search term" into tTextToFind
put the long id of this card into tCardLongId
lock screen
lock messages
find string tTextToFind in field "file contents"
if the long id of this card <> tCardLongId then
go back
unlock screen
answer "end of file contents reached"
end if
end findOnCard
In the list archives I came across solutions that involved looping over all the cards in the stack and setting the dontSearch to true, then setting the dontSearch of the current card to false. Whilst people on the list seemed to have no problem with this, I found it only worked sporadically and difficult to debug (could have been my fault - maybe I was missing something).
Looking through my old "Hypertalk 2.2" book, it looks like one ought to be able to do "find ... on marked cards", but I couldn't get that to work in Rev 2.7.4.
Anyway, I thought I'd just post this info here, in case someone in the future is searching for a simple way to restrict a Find to just one card.
Bernard