keyboard shotcuts to send commands to a TCC tab?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
May 5, 2010
9
0
#1
I'm new to Take Command and I'm learning it...

Is it possible to make a keyboard key send a command to a TCC tab? In fact, I would like the ESC key to send "cls" + [enter]. Is it possible?

I saw KEYSTACK and Key Mapping Directives but I'm not sure this is what I'm looking for.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,385
39
Albuquerque, NM
prospero.unm.edu
#2
I'm new to Take Command and I'm learning it...

Is it possible to make a keyboard key send a command to a TCC tab? In fact, I would like the ESC key to send "cls" + [enter]. Is it possible?

I saw KEYSTACK and Key Mapping Directives but I'm not sure this is what I'm looking for.
This is the sort of thing that keystroke aliases are for:

Code:
alias @@f5=cls
Unfortunately, the ESC key already has a function assigned; it clears the current command line. If you want to use it for CLS instead, you'll have to remove default mapping:

Code:
alias @@esc=cls
option //normalkey=esc
 
#3
| ---Quote (Originally by electrotype)---
|| I'm new to Take Command and I'm learning it...
||
|| Is it possible to make a keyboard key send a command to a TCC tab?
|| In fact, I would like the ESC key to send "cls" + [enter]. Is it
|| possible?
||
|| I saw KEYSTACK and Key Mapping Directives but I'm not sure this is
|| what I'm looking for.
| ---End Quote---
| This is the sort of thing that keystroke aliases are for:
|
|
| Code:
| ---------
| alias @@f5=cls
| ---------
| Unfortunately, the ESC key already has a function assigned; it
| clears the current command line. If you want to use it for CLS
| instead, you'll have to remove default mapping:
|
|
| Code:
| ---------
| alias @@esc=cls
| option //normalkey=esc
| ---------

One more point. The method Charles described works in either one of the
situations below:

1/ TCC runs stand-alone in its own window, and the window has focus when you
press the selected key, and TCC is waiting for keyboard input at the command
prompt; OR

2/ TCC runs in a TCMD tab, TCMD has focus, the intended TCC tab is currently
active, and TCC is waiting for keyboard input at the command prompt when you
press the selected key.

In other words, the keystroke must be delivered by Windows to TCMD, and by
TCMD to TCC, or directly by Windows to TCC, AND TCC must be ready to accept
and process it. Note:

1/ there is no mechanism for Windows to deliver a keystroke to any window
other than the currently active one, i.e., the one which has focus

2/ there is no mechanism for TCMD to deliver a keystroke to any tab other
than the currently active one

3/ if TCC is not waiting for a keystroke, a keystroke delivered to TCC is
not acted upon until TCC is ready to receive it, and some commands will
delete keystrokes waiting to be processed.

There are mechanisms in Windows to activate a specific window by
keystrokes. These keystrokes are intercepted by Windows no matter what
program has focus, and activate the desired window, but are not delivered to
the program running in that window. The alt-tab keystroke changes the focus
to the next window. If a window was created using a hotkey to execute a
desktop shortcut, under most circumstances the same hotkey will activate
that window (though on rare occasion the hotkey will execute the shortcut
instead). On my own systems I combine the alt-cntl-shift modifiers with
normal keys as shortcut hotkeys and window activators, because keystrokes
including that combination of modifiers are always intercepted by Windows,
so they cannot be used by applications, and are thus unique.
--
HTH, Steve
 
May 5, 2010
9
0
#5
Welll.. It works great when I type those commands in a TCC tab directly, but I'm unable to make them loaded automatically, from a .ini file. This is the first time I create a .ini file... Any help?

I created a TCMD.INI in the TCMD install directory. I tried this as the content:

Code:
alias @@esc=CLS /S 
option //normalkey=esc
Code:
ALIAS @@esc=CLS /S 
OPTION //normalkey=esc
Code:
esc=CLS /S 
//normalkey=esc
Code:
[4NT]
alias=@@esc=CLS /S 
option //normalkey=esc
Code:
[alias]
esc=CLS /S 
[option]
normalkey=esc
It always results in "invalid item name" or nothing at all occures.

What do I do wrong?
 
#6
Look at tcstart.btm instead of tcmd.ini

Sent from Cookie's iPhone
Jim Cook

On May 15, 2010, at 3:38, electrotype <> wrote:


> Welll.. It works great when I type those commands in a TCC tab
> directly, but I'm unable to make them loaded automatically, from
> a .ini file. This is the first time I create a .ini file... Any help?
>
> I created a TCMD.INI in the TCMD install directory. I tried this as
> the content:
>
>
> Code:
> ---------
> alias @@esc=CLS /S
> option //normalkey=esc
> ---------
>
> Code:
> ---------
> ALIAS @@esc=CLS /S
> OPTION //normalkey=esc
> ---------
>
> Code:
> ---------
> esc=CLS /S
> //normalkey=esc
> ---------
>
> Code:
> ---------
> [4NT]
> alias=@@esc=CLS /S
> option //normalkey=esc
> ---------
>
> Code:
> ---------
> [alias]
> esc=CLS /S
> [option]
> normalkey=esc
> ---------
> It alwats result in "invalid item name" or nothing at all occures.
>
> What do I do wrong?
>
>
>
>
 
#7
Aliases, environment variables and variable functions can only be
defined or modified by TCC commands ALIAS, SET, and FUNCTION, respectively.
The can be deleted (undefined) by the same commands using an empty string
after the equal sign "=", or more simply by the respecting "UNxxx" commands.
That's one of the fundamental issues with all of your attempts.
All directives (applicable to a specific version of TCMD / TCC) are
always "set", i.e., if the relevant SECTIONs of your .INI file do not assign
values to them explicitly, they receive a DEFAULT value. The primary way to
modify these values is by using the OPTION pull-down menu in TCMD, or the
DIALOG mode of the OPTION command in TCC, which modify, or (if necessary)
create the appropriate SECTION and DIRECTIVE entries in the SAME .INI file
which was used to start the current instance of TCMD or TCC, and are used in
all future invocations of the program that are started without explicit
filespecifation of the .INI file to be used. TCC directives can be modified
for the current instance of TCC only (and inherited by such instances that
are create either by PIPING or by the START command without using an
explicit filespecifiation of the .INI file) using the OPTION command as
described in help topic "option.htm".
Which .INI file the current instance of TCC used is availabe as the
value of the _ININAME internal variable. You can display it using the
command "echo %_ininame". This is the file that the dialog mode of of the
OPTION command would modify. If your TCC instance is running in a TCMD tab,
this .INI file is not necessarily the same as the .INI file which was used
when you started TCMD (e.g. if you used TCMD's OPTION dialog for it to
automatically create a TCC TAB with a command line which specifies a .INI
file). If your TCC tab was started in the default manner, TCMD's OPTION
pull-down menu allows you to modify the TCC options.

The TCC commands [UN]ALIAS, [UN]FUNCION, OPTION and [UN]SET allow you to
manipulate more than one entry at a time, using a file of definitions. The
definition syntax at the command line is different from the syntax in a
definition file. Each line in a definition file specifies a single item, and
is essentially in the format "name=value", and all values are used exactly
as entered (e.g. if the line contains a percent sign % followed by the name
of a variable it is not expanded to be the current value of the variable, it
is just placed in value AS WRITTEN). I believe that SECTION headers are
ignored in directive files loaded by the OPTION command (using OPTION
@file).

To manipulate the .INI file which started the current instance of TCC
your best method is to use the @INIREAD function to determine whether or not
it changes the default, and the @INIWRITE function to modify it for future
TCC instances:

echo Directive ANSI=%@iniread[%_ininame,4NT,ANSI]
echo %@iniwrite[%_ininame,4NT,ANSI,yes]