tcc history question

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Feb 9, 2010
9
0
#1
I am trying to get tcc to maintain the history so that when I restart my computer and relaunch tcc, I still have my past history to access. However, when I enable the options that appear to do what I want, then the history stops working properly. For instance, the last command I ran doesn't come up when I hit up arrow, but if I look at the log, it is in there, so I am confused.

Can someone explain how to get tcc to retain the history without messing up the way the history normally works?

Thanks,
Rusty
 
#2
On Fri, 19 Aug 2011 12:26:59 -0400, rcjackson0926 <> wrote:

|I am trying to get tcc to maintain the history so that when I restart my computer and relaunch tcc, I still have my past history to access. However, when I enable the options that appear to do what I want, then the history stops working properly. For instance, the last command I ran doesn't come up when I hit up arrow, but if I look at the log, it is in there, so I am confused.

The history file is not the one you want to use. It's not affected by your
chosen history size; it'll grow forever (mine is >6MB) and consequently will
take forever to load.

Read about SHRALIAS.

You can start it at logon from a BTM file in the startup folder, perhaps like
this

iff isdir %SHRALIAS_SAVE_PATH then
cdd %SHRALIAS_SAVE_PATH
for %f in ( *.sav ) %@name[%f] /r %f
SHRALIAS
delay 2
endiff

The delay is important; it keeps the current TCC from exiting (destroying the
shared lists) before SHRALIAS has attached to them (to keep them open).

When SHRALIAS exits (as it does at logoff) it automatically saves the various
lists (command history, directory history, aliases, user-defined functions).
 
#3
However, when I enable the options that appear to do what I want, then the history stops working properly. For instance, the last command I ran doesn't come up when I hit up arrow, but if I look at the log, it is in there, so I am confused.
What happens you press up arrow? When you say "log", do you mean the output of the History command?

Are you running one instance of TCC or multiple ones at the same time? What options did you enable? If you disable the options, does up arrow work?

In the options on the "Command Line" tab, I have a file specified for "History File" in the "Command History" group. This saves my history when TCC exits and reloads it when TCC starts. And, the up arrow works to retrieve the previous command.
 

samintz

Scott Mintz
May 20, 2008
1,204
11
Solon, OH, USA
#4
In my TCSTART.BTM file I have:

set s=Y
inkey /c /k"YN[Enter]" /w10
/x Restore Previous Environment? (Yn) %%s
echo.
iff "%s" eq "Y"
.OR. "%s" eq "@28" then
for %%s in (@c:\JPSOFT\drives.dat)
do cdd %%s
set /r c:\JPSOFT\env.dat
dirhistory /r c:\JPSOFT\dirhist.dat
history /r c:\jpsoft\history.dat
endiff

And I have a _4EXIT.BTM file that creates
the above files:

cdd /a > c:\jpsoft\drives.dat
cd >> c:\jpsoft\drives.dat
set > c:\jpsoft\env.dat
dirhistory > c:\jpsoft\dirhist.dat
history > c:\jpsoft\history.dat

-Scott




Quote:


Originally Posted by rcjackson0926

However, when I enable the options that
appear to do what I want, then the history stops working properly. For
instance, the last command I ran doesn't come up when I hit up arrow, but
if I look at the log, it is in there, so I am confused.
What happens you press up arrow? When you
say "log", do you mean the output of the History command?

Are you running one instance of TCC or multiple ones at the same time?
What options did you enable? If you disable the options, does up arrow
work?

In the options on the "Command Line" tab, I have a file specified
for "History File" in the "Command History" group.
This saves my history when TCC exits and reloads it when TCC starts. And,
the up arrow works to retrieve the previous command.
 
Feb 9, 2010
9
0
#5
On Fri, 19 Aug 2011 12:26:59 -0400, rcjackson0926 <> wrote:

|I am trying to get tcc to maintain the history so that when I restart my computer and relaunch tcc, I still have my past history to access. However, when I enable the options that appear to do what I want, then the history stops working properly. For instance, the last command I ran doesn't come up when I hit up arrow, but if I look at the log, it is in there, so I am confused.

The history file is not the one you want to use. It's not affected by your
chosen history size; it'll grow forever (mine is >6MB) and consequently will
take forever to load.

Read about SHRALIAS.

You can start it at logon from a BTM file in the startup folder, perhaps like
this

iff isdir %SHRALIAS_SAVE_PATH then
cdd %SHRALIAS_SAVE_PATH
for %f in ( *.sav ) %@name[%f] /r %f
SHRALIAS
delay 2
endiff

The delay is important; it keeps the current TCC from exiting (destroying the
shared lists) before SHRALIAS has attached to them (to keep them open).

When SHRALIAS exits (as it does at logoff) it automatically saves the various
lists (command history, directory history, aliases, user-defined functions).
Thanks for the help, that works great. Out of curiosity, can you explain what the for line is doing?

Rusty
 
#6
On Sat, 20 Aug 2011 13:10:02 -0400, rcjackson0926 <> wrote:

|iff isdir %SHRALIAS_SAVE_PATH then
| cdd %SHRALIAS_SAVE_PATH
| for %f in ( *.sav ) %@name[%f] /r %f
| SHRALIAS
| delay 2
|endiff
|
|Thanks for the help, that works great. Out of curiosity, can you explain what the for line is doing?

The files in that directory are

Code:
alias.sav
dirhistory.sav
function.sav
history.sav
Those filenames (no extensions) are also the names of TCC commands. The FOR
line turns those names into the following four commands, thus reading the saved
info into the global lists guarded by SHRALIAS.

alias /r alias.sav
dirhistory /r dirhistory.sav
function /r function.sav
history /r history.sav
 
Feb 9, 2010
9
0
#7
What happens you press up arrow? When you say "log", do you mean the output of the History command?

Are you running one instance of TCC or multiple ones at the same time? What options did you enable? If you disable the options, does up arrow work?

In the options on the "Command Line" tab, I have a file specified for "History File" in the "Command History" group. This saves my history when TCC exits and reloads it when TCC starts. And, the up arrow works to retrieve the previous command.
That is what I was doing as well, but with that enabled, my history wasn't working correctly. For instance, I have a batch file that I run frequently, but if I ran it, and then hit up arrow to run it again, it wouldn't come up, something else would. It just wasn't working correctly. However, the SHRALIAS command seems to do the trick for me.

Rusty
 
#9
On Sat, 20 Aug 2011 18:39:52 -0400, rcjackson0926 <> wrote:

|That is what I was doing as well, but with that enabled, my history wasn't working correctly. For instance, I have a batch file that I run frequently, but if I ran it, and then hit up arrow to run it again, it wouldn't come up, something else would. It just wasn't working correctly. However, the SHRALIAS command seems to do the trick for me.

I don't see how SHRALIAS would have fixed that. All SHRALIAS does is sit idly
after opening HANDLEs to the global memory-mapped files (so they're not closed
when no TCC is running).

There are two sets of radio buttons (OPTION\CommandLine\History). I believe the
top set controls how duplicate entries are handled when a command is first put
into the history and the bottom set controls how duplicates are handled when the
history is saved to a history file (is that right, Rex?). Check that those
options do what you want. I don't think there's a need for a history file when
using SHRALIAS and global lists; I have always used SHRALIAS and never a history
file.
 
#10
Is it possible your bat file is starting a new instance of TCC and your up arrow is going to it rather than to the previous instance? Try looking in Task Manager to see how many TCCs are running.

And, do check how you've set the various Command History options (Copy to end, Move to end, Duplicates), as Vince suggested.

Rex: The "Command Line" Help page says "First" and "Last" under "Duplicates", but the Option dialog says "Save First" and "Save Last".
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#11
There are two sets of radio buttons (OPTION\CommandLine\History). I believe the top set controls how duplicate entries are handled when a command is first put into the history and the bottom set controls how duplicates are handled when the history is saved to a history file (is that right, Rex?).
I don't know what you're referring to -- OPTION / Command Line / Command History only has one set of radio buttons. (Which control duplicates in the history list, not the history file.)
 
#12
On Sat, 20 Aug 2011 22:17:31 -0400, rconn <> wrote:

|I don't know what you're referring to -- OPTION / Command Line / Command History only has one set of radio buttons. (Which control duplicates in the history list, not the history file.)

There's

Code:
Copy to End                  Move to end
Wrap                         CaseSensitive

Duplicates:

Off          Save First      Save Last
Do they separately control recalled vs. newly-issued commands? If so, that's
not at all clear from only the OPTION dialog.
 
#13
Is it possible your bat file is starting a new instance of TCC and your up arrow is going to it rather than to the previous instance? Try looking in Task Manager to see how many TCCs are running.

And, do check how you've set the various Command History options (Copy to end, Move to end, Duplicates), as Vince suggested.

Rex: The "Command Line" Help page says "First" and "Last" under "Duplicates", but the Option dialog says "Save First" and "Save Last".
This is all that is in the batch file:

@echo off
type c:\temp\smusers.txt | grep -i %1 | c:\python31\python3 \util\clean.py

Rusty
 
#14
On Sat, 20 Aug 2011 18:39:52 -0400, rcjackson0926 <> wrote:

|That is what I was doing as well, but with that enabled, my history wasn't working correctly. For instance, I have a batch file that I run frequently, but if I ran it, and then hit up arrow to run it again, it wouldn't come up, something else would. It just wasn't working correctly. However, the SHRALIAS command seems to do the trick for me.

I don't see how SHRALIAS would have fixed that. All SHRALIAS does is sit idly
after opening HANDLEs to the global memory-mapped files (so they're not closed
when no TCC is running).

There are two sets of radio buttons (OPTION\CommandLine\History). I believe the
top set controls how duplicate entries are handled when a command is first put
into the history and the bottom set controls how duplicates are handled when the
history is saved to a history file (is that right, Rex?). Check that those
options do what you want. I don't think there's a need for a history file when
using SHRALIAS and global lists; I have always used SHRALIAS and never a history
file.
Interesting since you are the one that told me about the command and how to save my history with it. It does what you said, and everything is working like I want now.

Rusty
 
#15
Interesting since you are the one that told me about the command and how to save my history with it. It does what you said, and everything is working like I want now.

Rusty
I guess maybe you thought I meant that SHRALIAS fixed the up arrow problem. No, it didn't fix that technically, but I did turn off the logging of the history options, and that was what was causing the problems. Now that you told me how to use SHRALIAS to save the history the way I wanted, that in combination with turning the logging off solved the problems.

Thanks,
Rusty
 
#17
How exactly do you get up arrow to not work? Can you post the steps?
It works just not the same way it does with the options off. It doesn't bring up the last command I ran if I turn on the logging in the options. I am not sure exactly how it was choosing what to bring up when I hit up arrow, but it definitely wasn't what I wanted.

On the startup page, I checked the history box and entered a file name.

Then on the command line tab, I entered that file in the history box.

It was kind of doing what I wanted in terms of reloading the history, but since the history wasn't working normally anymore in terms of what came up when I hit up arrow, it was too annoying.

Rusty
 
#18
You don't need to turn on logging to use the Command History File option. The latter saves and restores the history by itself. It seems odd to use the same file for logging and for the Command History File. However, I just tried it, and up arrow works just fine.

Are you saying that up arrow doesn't work when you've just started TCC or does it not work if TCC is running, you do something (e.g., "dir"), then press up arrow?