Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ON <closing the console>

May
12,834
163
Is there a condition for the ON command that will be triggered when I "X" the console?

If not, there should be (IMHO), and is there another way to ensure that an action (saving data) is performed if the console is closed while a BTM is running?
 
The following worked when I "X"ed a tcc tab from within tcmd. It also worked when I "X"ed tcmd;

Code:
@setlocal
@echo off
on close echo Closed > c:\utils\close.log
input X the console:  %%fname
endlocal

Joe

TCC 15.01.52 Windows Vista [Version 6.0.6002]
TCC Build 52 Windows Vista Build 6002 Service Pack 2
Registered to Joe Caverly - 1 System License
 
Here's a neat little trick. Instead of creating a .log file, I add the info to the end of the .btm file;

Code:
@setlocal
@echo off
on close echo ::Closed %_date %_time >> c:\utils\ontest.btm
input X the console:  %%fname
endlocal
::Closed 10/12/13 10:42:30

Now you don't have to go looking through a .log file, just open your .btm to view the timeline.

Joe
 
How about TCEXIT? Esp. in conjunction with _EXIT?
I suppose that would work but it would involve editing TCEXIT every time I wanted to [un]implement it.
I guess I could, do something like this in TCEXIT ...
Code:
if defined _special_exit_command .and. %_pipe == 0 .and. %_transient == 0 _special_exit_command
... and have a BTM
Code:
set _special_exit_command=...
ON would be a lot easier
 
Another feature that would be useful in my current situation would be for a BTM file to be able to say (essentially) "TEE [/A] all of my output to a file". With such a feature, I wouldn't have to put TEE on the command line, or on every BTM line that might produce output.
 
Back
Top