unblocking @select?

May 31, 2008
382
2
I'm looking for ideas on how to unblock @select in a TCC LE script. I ran out of ideas and plugins to try.
Consider this script
Code:
do 2
  echo -- %@select[C:\Windows\win.ini,50,100,175,400,Select...]
enddo
When it runs it displays the selection window and stops. I want for the script to unblock @select and iterate when some event occurs. Is it possible? Of course, save for the user focusing the selection window and pressing ESC.
I tried various combinations of "signaling" methods, such as Vince's WATCHDIR (4threads.dll) with GENBREAK (4console.dll), or kludgy mouse presses with CLICK (sysutils.dll), or putting @select in a THREAD (sysutils), or sending ESC with sendkeys, ... Nothing worked to close the selection window in a reliable way. I noticed that WATCHDIR id path /I spec /E GENBREAK is able to at least close the window because it closes the script entirely, so there is no next iteration. With CLICK I can click the [X] to close the window - and that works - but it can't work if the console window is minimized or under another window, and it steals focus from the current window. Suggestions or alternatives? Thanks in advance.
 
Oct 18, 2009
363
17
I have found that in a lot of cases although in theory constructs like DO ... ENDDO ought to work, in practice they don't. I end up using a loop with a GOTO and that solves the problem, e.g.

:: Set whatever pre-conditions need to be set

Set count=5
Set end_count=10

:LOOP
Command_1
Command_2
Command_3

IF <CONDITION> GOTO EXIT_LOOP

GOTO LOOP

:EXIT_LOOP