Welcome!

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

SignUp Now!

TPipe relaunches TCC window and 4start, etc

Dec
13
0
Fellow Jeniuses (intentional misspelling to show our humility),

I have decided to try to break my old sed / grep / awk habits and start learning and using TPIPE.

When sitting at the TCC prompt, if I just type:

tpipe /grep=3,0,0,0,0,1,0,0,"Tract Master Main - " /input=TM_ALL_List.tmp

it appears that TCC reloads (I see my various 4start text roll by) and then, the results

Here is a normal TCC window start screen for me (mainly 4start stuff):

=====================
. Logged in as MJohnson4... Welcome to Work, Mark!
. Checking folders...
. We are now in the U:\DosUtils\4NT\ folder...
. Alias's read from U:\DosUtils\4NT\Work_Alias.sav file...
. Functions read from U:\DosUtils\4NT\Work_Functions_V12.sav file (by 4start)...
. Script 4Start being validated...
. Script 4Start Validated...
. Ctrl-T set to run TCC. Ctrl-F4 will exit TCC...
. Logging turned off...
. History read from U:\DosUtils\4NT\Work_History.sav file...
[U:\DosUtils\4nt]
=====================


now, I type the tpipe command:
tpipe /grep=3,0,0,0,0,1,0,0,"Tract Master Main - " /input=TM_ALL_List.tmp

that screen clears, then this appears:
=====================
. Logged in as MJohnson4... Welcome to Work, Mark!
. Checking folders...
. We are now in the U:\DosUtils\4NT\ folder...
. Alias's read from U:\DosUtils\4NT\Work_Alias.sav file...
. Functions read from U:\DosUtils\4NT\Work_Functions_V12.sav file (by 4start)...
. Script 4Start being validated...
. Script 4Start Validated...
. Ctrl-T set to run TCC. Ctrl-F4 will exit TCC...
. Logging turned off...
. History read from U:\DosUtils\4NT\Work_History.sav file...

\\row.myacmp.com\Guides and Recources\MLP Mortgage\REPORTS\MJohnson Master Files\All Areas Management\Tract Master Main - 20131105 V4c_278.xl
sx

\\row.myacmp.com\Guides and Recources\MLP Mortgage\REPORTS\MJohnson Master Files\All Areas Management\Tract Master Main - 20131105 V4c_279.xl
sx
set CCYYMMDD=20131115
set HHMM=0957
set stamp=201311150957
echo stamp set to: 201311150957
stamp set to: 201311150957
pushd U:\DosUtils\4NT
history > Archived\Work_History_201311150957.txt
copy /q Archived\Work_History_201311150957.txt Work_History.sav
popd
echo History saved as Work_History.sav
History saved as Work_History.sav
set CCYYMMDD=20131115
set HHMM=0957
set stamp=201311150957
echo stamp set to: 201311150957
stamp set to: 201311150957
pushd U:\DosUtils\4NT
copy /q 4nt.log Archived\Work_4nt_201311150957.log
echo > 4nt.log
popd
echo 4nt.log saved as Work_4nt_201311150957.log
4nt.log saved as Work_4nt_201311150957.log
[U:\DosUtils\4nt]
=====================


I see the TPIPE results (in bold) intermixed with a bunch of 'echoed on' 4start and startup alias commands.

If instead I use grep (GNU):
grep -i "Tract Master Main - " TM_ALL_List.tmp
the output is just 2 new lines at the current screen location:
=====================
[U:\DosUtils\4nt]grep -i "Tract Master Main - " TM_ALL_List.tmp

\\row.myacmp.com\Guides and Recources\MLP Mortgage\REPORTS\MJohnson Master Files\All Areas Management\Tract Master Main - 20131105 V4c_278.xlsx
\\row.myacmp.com\Guides and Recources\MLP Mortgage\REPORTS\MJohnson Master Files\All Areas Management\Tract Master Main - 20131105 V4c_279.xlsx
[U:\DosUtils\4nt]

=====================

How do I prevent TPIPE from reloading TCC and rerunning 4start (like grep does)?

--Peniel02
 
I see the same thing and I'm tempted to say that's just how TPIPE works (starting a transient TCC). But it does seem a little odd considering that TPIPE is internal and there are no (explicit) pipes. I imagine Rex will tell us what's going on.

Regardless of the explanation, you might want to put something like this at the beginning of TCSTART.BTM
Code:
IF %_PIPE == 1 .OR. %_TRANSIENT ==1 ( QUIT )
A pipe/transient instance of TCC will inherit much from it's parent TCC and there seems little reason to do much of what your TCSTART does in a pipe/transient instance.

Here, the screen doesn't clear. I suspect it clears for you because you ask it to in TCSTART.
 
The transient TCC exists to TYPE a temp file created by TPIPE. I don't know why that's necessary, but here, that transient TCC has a command line like
Code:
d:\tc15\tcc.exe /c type TP14021.tmp

I noticed another behavior which seems to be a bug. With "ECHO Starting TCSTART" at the beginning of TCSTART.BTM, here's normal (?), expected behavior:
Code:
d:\tc15> type tccbatch.btm | tpipe /grep=3,0,0,0,0,1,0,0,"2008"
Starting TCSTART
Starting TCSTART
  echo If you are running Windows 8, 7, 2008, or Vista, you must first start a TCC

If I put "PAUSE & ECHO Starting TCSTART" at the beginning of TCSTART, I get this behavior:
Code:
d:\tc15> type tccbatch.btm | tpipe /grep=3,0,0,0,0,1,0,0,"2008"
Press any key when ready...
Starting TCSTART
Press any key when ready...
Starting TCSTART

d:\tc15>

There is no actual PAUSE and there's no output! What's up with that?
 
Vince,

You hit that nail right on the head. I wondered how to "detect" that activity, and now I know!! I have changed my TCStart.btm, 4start.btm and 4exit.btm (all were being invoked!) and added various forms of:

Code:
IF %_PIPE == 1 .OR. %_TRANSIENT ==1 ( QUIT )

and now, TCC behaves as desired! (I get the exact same 3 lines output as grep or sed now! WOOHOO! I can start playing with TPIPE and learnin' it more gooder!

Vince - YOU ROCK! - and thanks to everyone for jumping in with the support - much appreciated!

--Peniel02
 
Or, if you don't want to eliminate ALL pipes from processing TCSTART, try this:
Code:
iff %@index["%cmdcmdline",/c type TP] gt 0 .and. %_pipe eq 1 then
  rem   TPIPE pipe process
  if %@regex[^TP\d+\.tmp$,%@word[-0,%cmdcmdline]] eq 1 quit
 endiff
 
How do I prevent TPIPE from reloading TCC and rerunning 4start (like grep does)?

TPIPE does not normally create a pipe (thereby invoking another child TCC process).

The internal TPIPE command invokes the external TPIPE.EXE app. If you do not specify an output file (or pipe the output somewhere else), TPIPE.EXE starts a secondary TCC shell using TYPE to dump the output to stdout.

So if you specify an output file (the normal behavior), you won't get the child process.
 

Similar threads

Back
Top