Dan,
One simple way is to use a True/False var to control the main loop
Then decide what condition will set the loop var to nil to force exit.
Jürg had a good example. My example uses the loop var as true to stay in the loop.
(setq loop t); stay in main loop
(while loop
*************
Do your stuff
Set exit flag when condition is met
*************
) ; end main while loop
(setvar 'osmode osm)
(princ)
Then find a way to signal the exit.
You have two entsel so the user may have two chances to signal the exit.
So the choices are to exit when:
User presses Enter
User selects wrong object
User misses an object
The choice is yours.
Read this thread.....
http://www.theswamp.org/phpBB2/viewtopic.php?t=4617&highlight=dan+escapeStig has given an example of how to catch the Escape key press & to look at other options.
In his example any of the conditions that end with T exit the while loop, not to be confused with
the main while loop. To exit that loop & the main while loop you must (setq loop nil)
Also consider that setting loop nil will not immediately exit the loop so you must find a way to
prevent any unwanted code from being executed. see Jürg's example again. He used the cond statement
to test for this condition.
That's all I have...