Just to elaborate some more:
On 4. Apr 2011, at 8:27 , Ţorvarđur Davíđsson wrote:
> I make a search in a macro and need to know whether something was found or not. How can I do that?
Rather than use "Read Selection" you can try things like this
$found = Find '.*', ‘Es’
if ! $found
prompt "nothing found."
exit
End
The "Find" command has the value "true" (actually "1" ) if something was found otherwise "false" (0)
Another approach is to use the the '$' option:
Find '.*', ‘$Es’
if $0 == ‘’
prompt “Nothing found”
exit
end
This has the advantage that you can actually check what was found, using the variable "$0". But this will only work for single finds.
If you are doing "Find all" then you will end up with a non-contiguous selection (an "array" of selections). In that case however it might be much a better idea to work with the language of text objects, but it really depends on what you are trying to do.
What are you trying to do?
Philip Spaelti
[log in to unmask]