TCC count internal variable

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jul 6, 2008
239
3
#1
Add an internal variable which returns the number of TC Consoles running either in tabs or standalone.

A TCC instance count may be a better description.

Perhaps even a variable for a count of TCMD tabs running TCC and another variable for the number of standalone TCC instances.
 
#2
Suggestion:
Add an internal variable which returns the number of TC Consoles running either in tabs or standalone.
A TCC instance count may be a better description.
In the meantime, could this function be of any use?
Code:
Function TEST=`%@execstr[ (tasklist /U"%1" tcc | echo %@lines[con:])]`
Where %1 is either empty (if you want all instances) or the username you want the number of running TCC instances from.

echo %@TEST[]
2
echo %@TEST[%username]
1
echo %@TEST[Maarten]
1


The result is not always accurate, though. This is caused by some weird behaviour of the @LINES function:
(but maybe it is good enough for your purposes):

2017-02-06 13_17_48-TCC.png


EDIT: Turns out to be caused by the "| ". It launches a fresh instance of TCC to execute the second part (I need more coffee :-).
The next function works better:
Code:
Function TEST=`%@execstr[ (tasklist /U"%1" tcc |! echo %@INC[%@lines[con:]])]`

echo %@TEST[Admin]
1

echo %@TEST[JohnDoe]
0
 
Last edited:
Jul 6, 2008
239
3
#6
There's already the %_TCTABS variable (returns the # of tab windows).
Not useful in a standalone TCC sessions or for knowing how many of the TCTABS are running TCC, some may be running other things such as Windows CMD.

I have several alias's that perform different exiting tasks and they need to determine how many TCC instances are running.

An internal variable would be cleaner and presumably faster than the function above.

Bottom line: %_tctabs doesn't meet the need. Thus the suggestion to add an internal variable which returns the number of TC Consoles running either in tabs or standalone. Just saying.

While we're on the subject of addition for future TCC version.

It would also be useful to have internal variables to use in determining global command history, directory history, alias and user function lists status within a TCC session.
 
Last edited:
#11
Maarten, yours is quite fast if you put it into a variable and don't care about the user.
Code:
v:\> set __tcccount=`%@execstr[ (tasklist tcc |! echo %@INC[%@lines[con:]])]`

v:\> timer echo %__tcccount
Timer 1 on: 21:00:22
9
Timer 1 off: 21:00:22  Elapsed: 0:00:00.00
 
#12
Code:
v:\> set __tcccount=`%@execstr[ (tasklist tcc |! echo %@INC[%@lines[con:]])]`
[...]
Timer 1 off: 21:00:22  Elapsed: 0:00:00.00
Well, what do you know ... it was the timer on & timer off sequence that consumed most of the time ...
Nice work with the backquotes, btw. Makes it look much cleaner!


Shouldn't this be even faster, then?:
set __tcccount=`%@execstr[tasklist tcc | echo %@lines[con:]]`

("|!" becomes "|" ; faster according to the helptext. This also eliminates the cause for the extra @inc )

Thanks Vince! Learned a lot today.