Conditional FindInLine equivalent in source scripts?

I'm spending my second hour on scripting, and just realized that it's impossible to understand inside the script that some text is exists. If and Do/While operators does their job only for current cursor position. The result is nice scripting like this:

# Primary Cover - backasswards because FindInLine 
# does exception if nothing found
FindInLine "<artists>"
MoveChar -18
If "</images>"
    # We sure now that primary image exists
    OutputTo "COVERURL"
    GotoChar 1
    FindInLine "type=\"primary\" uri=\""
    SayUntil "\""
EndIf

Luckily tag in this particular case always exists. If less lucky, the puzzle could be unresolvable.

It would be great to have something like, for example, IfExists operator:

# Primary Cover
IfExists "<image type=\"primary\""
    OutputTo "COVERURL"
    GotoChar 1
    FindInLine "<image type=\"primary\" uri=\""
    SayUntil "\""
EndIfExists