set count to 0

repeat until (stopString = "stop")

    ...


    if count > 10 then
        set stopString to "stop"
    end if

    set count to count + 1

end repeat