How to? Use both TCC-RT and TCC on same PC

Oct 18, 2009
185
7
#1
How can I use both TCC-RT and TCC on the same PC, other than by installing multiple user accounts?

The reason I want to do that is so I can test programs that will run under RT. I assume that if I simply run the RT installer conflicts will arise with the existing TCC installation and I won't have a way to know whether TCC is handling the program or RT.

The particular program set runs multiple programs at different times including LibreOffice Calc, Excel, Notepad++, FileZilla client and others. So I don't want to set up all those on a "spare" PC just for test purposes. (And it's at my employer where we don't have spare PC's anyway.)
 
Oct 18, 2009
185
7
#3
TCC installs both TCC and TCMD, so that doesn't prove anything. The version of TCC I have is 18.

Will running the RT installer change any of the existing file associations?

When I double-click on a .btm file in Windows Explorer, how would it know whether to use RT or TCC? For my normal uses I would want it to run TCC. But for testing I would want it to run RT because that is what will ultimately be used on other computers. I don't want to have to repeatedly run a program that changes the association of .btm files.

I need to be able to write up instructions that are literally "Press [keys]. Go to Step 2." Some of the people I work with don't even know what Windows Explorer / File Explorer / File Manager is. So "Single-click on whatever.btm, right-click, select Open with RT" (etc) isn't an option.
 
Oct 18, 2009
185
7
#5
At install time, you have a choice of whether to associate the product being installed with .BTM (and/or with other extensions).
That's the problem. I need to be able to switch back and forth, without running anything that is going to repeatedly screw with the registry.

The basic scenario would be this:

On my PC I write the code and double-click the .btm file in Windows Explorer to test it. Once it seems to be working I "change some setting" and double-click again, and now it runs in RT, which is what it will run under on someone else's PC. Then I "change the something" again and it reverts to .btm files will run under TCC.

I have a lot of .btm files that won't be running on someone else's PC and if the programs I'm writing and testing are running on my PC I would want them running under TCC, not RT. I would only have things running on my PC under RT for test purposes.

==========

Currently, I'm the only one who actually uses the programs. Because of company politics, if I do put them on someone else's PC it's not a situation where I can make updates and test them on the other person's PC. I would have to know before I put them on that PC that they will work, so it would be a matter of "come back in 5 minutes and the update will be finished". And I know my employer isn't going to spend $50-100 per seat to put TCC on PC's--I'm using my own license.
 
#7
Starting a BTM with a double-click in Explorer is going to use the setting in the registry if there is one; there's no way around that. You will have to do SOMETHING to change the behavior. How would you want to do that?

I can't think of anything easier than an alias (or BTM) that uses FTYPE to change how Explorer starts a BTM (i.e., screws with the registry).
 
Oct 18, 2009
185
7
#8
How about placing a shortcut to TCC-RT on your desktop and then drag and drop your .btms onto it to run them?
Not an option. First, various parts of the program set CALL other "lookup" programs.

Also, the folder contains numbered "steps", e.g.

0 - Download from client.btm
1 - Move files to today's folder.btm [one subfolder for each day of the year sorted by month]
2 - Run conversion.btm
3 - Run import.btm

The instructions are basically:
1) "In Windows Explorer go to F:\CLIENT DOWNLOADS\client_name" Go to step 2
2) Double-click 0 Download from client.btm. Go to step 3.
3) Double-click 1 - Move to today's folder.btm Go to step 4.

The example looks simple. But this is interfacing with a DOS database written by someone with no programming training. The database has no data validation or error trapping and the no-name 1991 database manager allows things like slashes in field names and putting text in currency fields. So users often accidentally change the data. As a result, between "Go to step 2" and the Step 2 instruction there may be a page and a half of "if you run into this problem, do this. If you run into this problem do this ...."

There are only 10 numbered programs, but the instructions are about 40 pages. (A lot of the downloaded data is garbage, such as chopped-off middle names or addresses such as 1000 GENERAL DELIVERY, so the instructions also include how to check for those.)

And keep in mind that in some cases we're talking users who don't know what Windows Explorer / File Explorer / File Manager is! So the owner would consider "drag and drop" "way too complicated."

And, no, the owner is not interested in switching to a Windows database. Every time that is suggested her response is "We'll probably do that at some point." The database she set up has one file, with over 330 fields, including some screens with two fields with the same fieldname. The only way to get data in or out programmatically is in .csv format. Although theoretically the database manager can export in .DBF format, because of the fieldnames-with-slashes, 330+ fields, lax-data-typing, and multiple-fields-with-same-name problems, all the programs I've tried say the DBF is invalid.

(Just to be clear about "same fieldname", this is not a database where you have a label on a screen that can be anything and a separate field with a fieldname. The fieldname is the label.)
 
Last edited:
Oct 18, 2009
185
7
#9
Starting a BTM with a double-click in Explorer is going to use the setting in the registry if there is one; there's no way around that. You will have to do SOMETHING to change the behavior. How would you want to do that?

I can't think of anything easier than an alias (or BTM) that uses FTYPE to change how Explorer starts a BTM (i.e., screws with the registry).
I put in a suggestion for Rex about setting an environment variable (hence, no screwing with the registry) and changing TCC that it looks for that variable and if it is set to "RT" it will simply "hand off" anything to RT. CALL would have to be changed to do the same thing.

One of the things I used to use years ago was a "switch file". Basically:

IF EXIST C:\MY_FOLDER\MY_PROGRAM\Program_1 [DO WHATEVER]
IF EXIST C:\MY_FOLDER\MY_PROGRAM\Program_2 [DO SOMETHING_ELSE]

It's not a SWITCH option of running multiple programs. It's really just "If USE_whatever exists, go to the other program". WordPerfect "macro" language is really a full-blown programming language and I use that to select which of two programs will run when I press F9 while in WordPerfect.

In this case maybe there could be a tcstart.btm option of USE_RT.yes

Or maybe TCMD.ini could have a setting that will automatically switch to RT.
 
Last edited:
#10
You can do that yourself. Let TCSTART.BTM make the decision. I just put this at the beginning of TCSTART.BTM (make it fancier if you like).
Code:
IFF DEFINED USE_TCC_RT THEN
   START /B g:\tcc-rt\tcc.exe %$
   EXIT
ENDIFF
I could toggle the behavior of 2-clicking in Explorer with one of these.
Code:
v:\> set /u use_tcc_rt=Yes

v:\> unset /u use_tcc_rt
In my simple test, I used a BTM which did this.
Code:
ver
pause
 
Oct 18, 2009
185
7
#11
You can do that yourself. Let TCSTART.BTM make the decision. I just put this at the beginning of TCSTART.BTM (make it fancier if you like).
Code:
IFF DEFINED USE_TCC_RT THEN
   START /B g:\tcc-rt\tcc.exe %$
   EXIT
ENDIFF
I just tried that with each of the following and they all cause an endless loop:
  1. {environment variable} IFF DEFINED
  2. {switch file} IFF EXIST C:\TEMP\USE_TCC_RT.TXT
  3. {RT internal variable} IFF "%_TCCRT" EQ ""
  4. {RT internal variable} IFF "%_TCCRT" NE ""

Whenever the IFF is true it causes an endless loop. If the IFF is false it runs TCC not TCC-RT.

If the internal variable is true it causes a loop, if it is false TCC runs, not RT.

I am running TCC 18, not 20. That's why I have quotes around the internal variable.
 
#12
The only thing I see that would cause an infinite loop is if you also put that code in TCC-RT's TCSTART.BTM. It belongs only in the normal TCC only, the one which Explorer invokes. That could happen inadvertantly if TCC-RT were using TCC18's TCSTART.BTM (check TCC-RT's options for the location of its 4start/TCStart).

It works here, like this: Explorer calls the normal TCC. That TCC looks for and finds USE_TCC_RT in it's environment, starts TCC-RT in the same console, and exits. TCC-RT doesn't look for the variable; it just runs the BTM.

What's the v18/v20 difference you're talking about? I am testing with Explorer pointing to v19.
 
Oct 18, 2009
185
7
#13
I just tried it a bit different and it's working.

Code:
@echo off
Set path=C:\Program Files\JPSoft\BTM;%path
CALL "C:\Program Files\JPSoft\BTM\setalias.btm"

IFF EXIST C:\TEMP\USE_TCC_RT.TXT THEN
   "C:\Program Files\JPSoft\TCC_RT_20\tcc.exe" %$
   EXIT
ENDIFF
(Note that the Set path and CALL are completely unrelated.)
It should also work with an environment variable, although I prefer switch files, since they don't require special setups or changes to the user's PC.

=============
Below are two files used to test calling from one .btm to another:

Filename: 0-show_ver.btm
Code:
@echo off
Echo 0-show
ver
CALL "c:\Program Files\JPSoft\BTM\1-show_ver.btm" ABC
Echo Back from 1-show
pause
Filename: 1-show_ver.btm
Code:
@echo off
ver
Echo Data received from 0-show: %1
pause
 
Nov 2, 2008
187
1
#15
Could you set 'run with RT' as a non-default option in the pop-up menu. RT should set itself as a local shell.

I've run three versions of TCC with 'open with tcc 19' and 'open with tcc 20'. You just edit the 'assoc with tcc' batch.
 
#16
I think you painted yourself quite nicely in the corner with these strict requirements (what's wrong with "screwing with the registry" ?)

Luckily there are some Windows (ahem) to escape through :-)
A few of them are already mentioned, but be aware that using "regular" TCC as a pass-through might cause global aliasses, functions, etc to "leak" into your TCC-RT and cause unpredictable results.

I can think of quite a few other ways to solve this, but most of them are not very "1991" as they require advanced registry trickery.
Here are the more straightforward ones that you might consider:


Visible differences between TCC and TCC-RT
This is the most straighforward one: put a BEEP and a PAUSE in the tcstart.btm of TCC-RT, use different screencolours, etc so you know you are using the testversion and can change the file association if neccessary.
The titlebar gives you this information also, but that might be overlooked (or changed).


CMD as a switchboard
This one requires you to change the registry once.

Basically it associates .BTM files with a .CMD script (not CMD.exe ... a CMD script).
Then that script decides on criteria you specify (environment variable, flag file,...) what to start: TCC or TCC-RT
The CMD-script (based on my current paths and versions; tailor those to your situation):

C:\Temp\TEST_TCMD\FLIP.CMD
Code:
@echo off
IF exist c:\temp\RT.txt (
   start "TCC RT 20" "C:\Temp\TEST_TCMD\CompleteVersies\RT_20.11.41\tcc.exe" /C %*
) ELSE (
   start  "TCC 20"  "C:\Temp\TCMD20\tcc.exe" /C %*
)
Add this to your registry (Again: tailor to your situation):
Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TCC.Batch]
@="TCC switchboard"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TCC.Batch\SHELL]
@="FLIPSWITCH"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TCC.Batch\SHELL\FLIPSWITCH]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TCC.Batch\SHELL\FLIPSWITCH\Command]
@="\"C:\\Temp\\TEST_TCMD\\FLIP.CMD\" \"%1\" %*"
Side-effect: FTYPE always shows the command specified in the default "Open" key, so it will report the wrong association. I could re-use the "Open" keyword, but that is where Take Command installations write. This way it can't be accidentally overwritten.

Now, if you double-click a .BTM in explorer, FLIP.CMD will be started (you can see that window flash very shortly on your screen) and that will start the correct TCC.exe.


A flipswitch on your desktop that changes and shows the current association state
( Based on [title] )
This one changes the registry everytime, but shows you the state it is in (TCC or TCC-RT)
Instructions:
  • Put this script somewhere on your system
  • Change the settings in the script
  • Start it once.
  • It will create an icon on your desktop.
  • From now on you can doubleclick this icon to switch between TCC an TCC-RT. The icon shows you the current association (green=TCC; red=TCC-RT)
If you remove the current TCC (-RT) version and install another one, the script will alert you (and show an exclamation mark icon too, to make you aware you have to change the settings.

The script uses FTYPE. You could also use FTYPE /U to change the setting in userspace


Code:
@echo off
echo on
setlocal

::==============[ SETTINGS ]===================

   set LINKNAME=TCC association
   set TCC=C:\Temp\TCMD20\TCC.EXE
   set TCCRT=C:\Temp\TEST_TCMD\CompleteVersies\RT_20.11.41\tcc.exe

::==============[ END SETTINGS ]===============

rem assoc .btm=TCC.Batch

SWITCH "%_cmdspec"
CASE "%TCC"
   ftype TCC.Batch="%TCCRT%" /c "%%1" %%*
   SHORTCUT "%_batchname" "" "" "TCC Flip" "%USERPROFILE%\Desktop\%LINKNAME.lnk" 1 "C:\Windows\System32\imageres.dll" 100
   echo.
   echo. Don't forget to close all TCC's first
   echo. to prevent "leaking" of global aliasses and other settings
   echo.
   pause
   rem taskkill ....
CASE "%TCCRT"
   ftype TCC.Batch="%TCC%" /c "%%1" %%*
   SHORTCUT "%_batchname" "" "" "TCC Flip" "%USERPROFILE%\Desktop\%LINKNAME.lnk" 1 "C:\Windows\System32\imageres.dll" 101
DEFAULT
   echo.
   echo.   "%_cmdspec" is not one of the options!
   echo.
   echo.   Current options:
   echo.      %TCC
   echo.      %TCCRT
   echo.
   echo. Update this script (%_batchname)
   echo.
   SHORTCUT "%_batchname" "" "" "TCC Flip" "%USERPROFILE%\Desktop\%LINKNAME.lnk" 1 "C:\Windows\System32\imageres.dll" 102
   pause
ENDSWITCH
Good luck and have fun!
 
Last edited:
Nov 2, 2008
187
1
#17
This is my current multi-install version of 1assoc.cmd, modified to be relevant to 4vista. The batch files are in 'required order', so '1assoc.cmd' depends on changes made in '0config', and in turn '2mkfolder' depends on '1assoc', since we put documents there too.

If you are running your series of batch files in a depended order, you could use names like this, 0step1.btm etc.

In practice, ztcc, ztcr come from a registry setting hklm\software\wendy\folders.

This batch is normally run in an elevated CMD session, we use Frank Westlake's conset to read the registry, and reg.exe from the Win2k reskit to set registry.

tcc-rt does not handle the 'open x here' settings, but you can use tccle there. I just use tcc.exe

For the user installs, you could use something like the following batch file, to create the associations, or create a group in the start menu, which can be updated from a batch file (with shortcut), to set the path to the current day's activity.

Code:
::  set ztcc=Path where tcc, tc live   ztcc=d:\newin\tcmd20
::  set ztcr=Path to tcc/runtime
::  set ztcl=Path to tcc-LE  etc.
::
:: 4vista
set zexec1=%ztcc%\tcc.exe
set zexec2=%ztcc%\tc.exe
set zexec3=%ztcr%\tcc.exe
set zdesc=4NT Batch file

set ztype=TCC.Batch
reg add HKCR\.btm /f /ve /d %ztype%
reg add HKCR\%ztype% /f /ve /d "%zdesc"
reg add HKCR\%ztype%\DefaultIcon /f /ve /d %zexec1%,0
reg add HKCR\%ztype%\shell\Open\command /f /ve /d "%zexec1% %%1"
reg add HKCR\%ztype%\shell\Runtime /f /ve /d "Runtime"
reg add HKCR\%ztype%\shell\Runtime\command /f /ve /d "%zexec3% %%1"
set ztype=cmdfile
reg add HKCR\%ztype%\shell\TCC /f /ve /d "Open with TCC"
reg add HKCR\%ztype%\shell\TCC\command /f /ve /d "%zexec1% %%1"
reg add HKCR\%ztype%\shell\Runtime /f /ve /d "Runtime"
reg add HKCR\%ztype%\shell\Runtime\command /f /ve /d "%zexec3% %%1"

set ztype=Drive\shell
reg add HKCR\%ztype%\tcc /f /ve /d "TCC Prompt"
reg add HKCR\%ztype%\tcc\command /f /ve /d "%zexec1% %%1"

set ztype=Directory\shell
reg add HKCR\%ztype%\tcc /f /ve /d "TCC Prompt"
reg add HKCR\%ztype%\tcc\command /f /ve /d "%zexec1% %%1"

set ztype=Directory\Background\shell
reg add HKCR\%ztype%\tcc /f /ve /d "TCC Prompt"
reg add HKCR\%ztype%\tcc\command /f /ve /d "%zexec1%"
 
Last edited:
Nov 2, 2008
187
1
#18
You could, of course, simply create a reg-type for tccrt-batch, vs tcc-batch, and use assoc .btm=tccrt-bat vs assoc .btm=tcc-batch. This exists under cmd, and is not all that difficult to do.
 
#19
If you don't want to be dependant of external utilities, you could also do this in CMD:

Code:
for /f "usebackq tokens=1,2,* delims= " %x in (`reg query "hklm\software\wendy\folders" /v ztcc`) DO set ZTCC=%z
When used in a script, you should double the % (as you probably already know)

(BTW: what is 4Vista?)
 
#21
Earlier I suggested something like this in TCSTART.BTM.
IFF DEFINED USE_TCC_RT THEN
START /B g:\tcc-rt\tcc.exe %$
EXIT
ENDIFF
Then I wondered ... what if I wanted the first (Explorer-defined) TCC to hang around, possibly so I could see TCC-RT's output? I could remove the "EXIT" and add "/WAIT" to the START command. The problem with that is that when TCC-RT finishes, and TCSTART.BTM ultimately finishes, the current TCC also runs the command line (and the BTM whose Shell\Open command was invoked). I could get around that with "START /WAIT /B TCC-RT ..." ..."START /B TCC" ... EXIT. Now I wonder if there's a way that TCSTART.BTM can tell TCC to forget about its (TCC's) command line, saying, in effect, I handled the command line, just start normally. I'd guess "No". I don't know how useful it'd be but it might be easily done (for example, by checking TCSTART's QUIT/CANCEL value).
 
#22
You could, of course, simply create a reg-type for tccrt-batch, vs tcc-batch, and use assoc .btm=tccrt-bat vs assoc .btm=tcc-batch. This exists under cmd, and is not all that difficult to do.
That was one of the "registry trickery" I could think of:
Create a TCC.Batch and a TCCRT.Batch; convert the default value of .BTM to REG_EXPAND_SZ and give it the value %FLIP%.Batch
With set FLIP=TCC or FLIP=TCCRT you could switch between the two. Not tested, though, as it would probably be flagged as "not an option".

And I also didn't know if an already running Explorer filemanager would pick up on this changed environment variable.
If only I had a way to get in contact with the author of the world famous SETENV utility .... ;-)
He would know how to make that work.
 
#23
Earlier I suggested something like this in TCSTART.BTM.

Then I wondered ... what if I wanted the first (Explorer-defined) TCC to hang around, possibly so I could see TCC-RT's output? I could remove the "EXIT" and add "/WAIT" to the START command. The problem with that is that when TCC-RT finishes, and TCSTART.BTM ultimately finishes, the current TCC also runs the command line (and the BTM whose Shell\Open command was invoked). I could get around that with "START /WAIT /B TCC-RT ..." ..."START /B TCC" ... EXIT. Now I wonder if there's a way that TCSTART.BTM can tell TCC to forget about its (TCC's) command line, saying, in effect, I handled the command line, just start normally. I'd guess "No". I don't know how useful it'd be but it might be easily done (for example, by checking TCSTART's QUIT/CANCEL value).
I like the way you think: keep asking yourself questions that in itself are not very important (and neither are the answers), but forces you to think about and experiment with a product that you probably use quite a lot. This sharpens your mind, learns you the ins and outs of the product and maybe you even discover the question of Life, the Universe and Everything. And if not: still some fun to be had.

I'm not with you on this quest (too little time, too little to gain), but a few suggestions (probably rubbish):
First part: keeping the "Host-TCC" alive
TCSTART.btm is just a batchfile. You could do anything you like, as long as you stay within the original IFF DEFINED ..
You could create loops, start one of the MONITOR commands, call other scripts ... but start /wait is not one of those options. TCSTART comes to a halt until TCC-RT is ended. That would make keeping the host alive pointless.

Second part: escaping the commandline options:
No idea at all, but if you leave the loop after TCC-RT is ended like mentioned above, you can do a simple EXIT

(All this is assuming that I did understand your original question correctly)
 
#24
If TCSTART doesn't say EXIT, then, when the host TCC is done executing TCSTART, it will take over and execute the command line it was given (by Explorer). I was wondering if that could be suppressed (executing the original command line) since, in this very specialized case, TCC-RT already executed that command line.

I already know that one. It's 42, of course.
 
#25
If TCSTART doesn't say EXIT, then, when the host TCC is done executing TCSTART, it will take over and execute the command line it was given (by Explorer). I was wondering if that could be suppressed (executing the original command line) since, in this very specialized case, TCC-RT already executed that command line.
I really have no idea. Don't think it is saved in a variable like %CMDLINE or something. Rex could tell you, I guess.

I already know that one. It's 42, of course.
:-)

EDIT: And now the real question: What was the original question? :-)

There might be some sort of "solution" to the second part. As a matter of fact: it is your own solution! : Block access to the .BTM when running TCC-RT using one of the techniques described here: [title]
Then you can safely end TCC's TCSTART.btm.
 
Last edited: