Message Box question
Posted: Sat Nov 30, 2013 3:55 pm
Some of my projects remain and are kept uncompiled, that is, as editable stacks. These stacks contain in some cases thousands of cards with text fields. I frequently search them using the Message Box and a simple "search textToFind" which does a fine job of locating a word and finding subsequent instances with each press of the Return key. However, when I attempt to script this action by putting directly to the Message Box, as in:
put "Find" && quote & textToFind & quote -- (that is, in the message box)
my line is placed into the Result Area of the Message Box, not the Command Area.
CAN SOMEONE EXPLAIN TO ME WHY IT IS NOT POSSIBLE TO PUT DIRECTLY INTO THE COMMAND AREA VIA SCRIPT?
Likewise, I have tried the following as a way to create an easily executed serial-search for a word:
on commandKeyDown theKey
if theKey is not "F" then exit commandKeyDown
ask "Find:"
if it is not empty then find it
if the result is "Not found" then
answer the result
exit commandKeyDown
end if
put it into mySearch
repeat forever
answer "Find next " & mySearch & "?" with "Cancel" or "Next"
if it is "Cancel" then exit commandKeyDown
else
find mySearch
if the result is "Not found" then
answer the result
exit commandKeyDown
end if
end if
end repeat
end commandKeyDown
BUT THIS FAILS TO SUCCESSFULLY FIND ANY BUT THE FIRST INSTANCE!
Any ideas are appreciated. I want an easy search function (a la HyperCard and it's simpler Message Box) in order to casually flip thru a stack for a term.
put "Find" && quote & textToFind & quote -- (that is, in the message box)
my line is placed into the Result Area of the Message Box, not the Command Area.
CAN SOMEONE EXPLAIN TO ME WHY IT IS NOT POSSIBLE TO PUT DIRECTLY INTO THE COMMAND AREA VIA SCRIPT?
Likewise, I have tried the following as a way to create an easily executed serial-search for a word:
on commandKeyDown theKey
if theKey is not "F" then exit commandKeyDown
ask "Find:"
if it is not empty then find it
if the result is "Not found" then
answer the result
exit commandKeyDown
end if
put it into mySearch
repeat forever
answer "Find next " & mySearch & "?" with "Cancel" or "Next"
if it is "Cancel" then exit commandKeyDown
else
find mySearch
if the result is "Not found" then
answer the result
exit commandKeyDown
end if
end if
end repeat
end commandKeyDown
BUT THIS FAILS TO SUCCESSFULLY FIND ANY BUT THE FIRST INSTANCE!
Any ideas are appreciated. I want an easy search function (a la HyperCard and it's simpler Message Box) in order to casually flip thru a stack for a term.