Append command line to @@key alias?

May 20, 2008
11,285
95
Syracuse, NY, USA
Is there a way to append the current command line to an @@key alias (instead of the default insert/overwrite behavior)? For example, alias @@F2=command (?) in such a way that if I type "foo" and then press F2, "command foo" is executed?
 
May 20, 2008
11,285
95
Syracuse, NY, USA
On Wed, 18 May 2011 13:52:46 -0400, rconn <> wrote:

|No. There isn't any variable substitution in key aliases.

It could be just my lack of imagination, but I can't think of a situation where
I'd use an automatic key alias (@@) to insert something into a command line in
progress, at the cursor position, and then execute that command line. That's
how it behaves.

Code:
v:\> alias @@f2 dir

v:\> p:\4Utils\ [F2]
TCC: Unknown command "p:\4Utils\dir"

Does anyone use an @@key alias with a command line in progress? ... have a good
example?

It would seem much more useful to insert at the beginning of the line followed
by a space.
 
May 20, 2008
11,285
95
Syracuse, NY, USA
On Wed, 18 May 2011 14:25:26 -0400, vefatica <> wrote:

|On Wed, 18 May 2011 13:52:46 -0400, rconn <> wrote:
|
||No. There isn't any variable substitution in key aliases.
|
|It could be just my lack of imagination, but I can't think of a situation where
|I'd use an automatic key alias (@@) to insert something into a command line in
|progress, at the cursor position, and then execute that command line. That's
|how it behaves.
|
|
|Code:
|---------
|v:\> alias @@f2 dir
|
|v:\> p:\4Utils\ [F2]
|TCC: Unknown command "p:\4Utils\dir"
|---------
|Does anyone use an @@key alias with a command line in progress? ... have a good
|example?
|
|It would seem much more useful to insert at the beginning of the line followed
|by a space.

Even better ... insertion at the beginning plus full-blown parameter
substitution from the command line in progress.
 

samintz

Scott Mintz
May 20, 2008
1,488
15
Solon, OH, USA
It's useful for things like:

alias @@Alt-F4=exit^n

-Scott

vefatica <> wrote on 05/18/2011 02:25:26 PM:


> It could be just my lack of imagination, but I can't think of a
> situation where
> I'd use an automatic key alias (@@) to insert something into a command
line in

> progress, at the cursor position, and then execute that command line.
That's

> how it behaves.


> Code:
> v:\> alias @@f2 dir
>
> v:\> p:\4Utils\ [F2]
> TCC: Unknown command "p:\4Utils\dir"
> Does anyone use an @@key alias with a command line in progress? ...
> have a good
> example?
>
> It would seem much more useful to insert at the beginning of the line
followed

> by a space.
>
>
 

rconn

Administrator
Staff member
May 14, 2008
12,315
148
It could be just my lack of imagination, but I can't think of a situation where I'd use an automatic key alias (@@) to insert something into a command line in progress, at the cursor position, and then execute that command line. That's how it behaves.

That's how it's always behaved, and that's how people wanted it. It will definitely NOT be changed now!
 
May 20, 2008
11,285
95
Syracuse, NY, USA
On Wed, 18 May 2011 17:03:07 -0400, samintz <> wrote:

|It's useful for things like:
|
|alias @@Alt-F4=exit^n

That wouldn't work in a command line in progress.

Code:
v:\> alias @@Alt-F4
exit


v:\> foo[Alt-F4]
TCC: Unknown command "fooexit"

I use:

Code:
v:\> alias @@Ctrl-F10
@exit

That's [Esc]@exit (to clear the command line and keep it out of the history).

Note I use Gateway "AnyKey" keyboards and there's an F10 right next to the left
Ctrl key.
 
May 20, 2008
11,285
95
Syracuse, NY, USA
On Wed, 18 May 2011 17:05:47 -0400, rconn <> wrote:

|---Quote (Originally by vefatica)---
|It could be just my lack of imagination, but I can't think of a situation where I'd use an automatic key alias (@@) to insert something into a command line in progress, at the cursor position, and then execute that command line. That's how it behaves.
|---End Quote---
|
|That's how it's always behaved, and that's how people wanted it. It will definitely NOT be changed now!

I never dreamed you'd change it. I was just wondering about uses for it in a
command line in progress.
 
May 20, 2008
11,285
95
Syracuse, NY, USA
It'd be easy enough to do in a keystroke plugin, though....

Not hard to do for just the unmodified F keys (code below).

Rex, how does TCC handle checking if a keystroke corresponds to a keystroke alias? ... some kind of a hash table I imagine ... could I kludge access to it?

Code:
int F[13] = {0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12};
for ( INT i=1; i<=12; i++ )
{
    if ( lpKeyInfo->nKey == F[i] )
    {
        WCHAR szAliasName[8], szSave[4096], *pszAlias;
        Sprintf(szAliasName, L"@@F%d", i);
        pszAlias = GetAlias(szAliasName);
        if ( pszAlias != NULL )
        {
            lstrcpy(szSave, lpKeyInfo->pszLine);
            Sprintf(lpKeyInfo->pszLine, L"%s %s", pszAlias, szSave);
            lpKeyInfo->nKey = 13;
            return 0;
        }
    }
}
 
May 20, 2008
3,515
4
Elkridge, MD, USA
A common situation is when you have a command calling a batch file:
xxx p1 p2 ...
and you want to run the debugger, so you want to convert it to:
bdebugger %@search[xxx] p1 p2 ...

This requires a complicated operation, consisting of the following steps:

1/ change edit mode to INSERT
2/ go to beginning of line
3/ insert the string "bdebugger %@search["
4/ go to the end of the first word
5/ insert "]"
6/ go to end of line
7/ insert "<enter>"

Step 6 may not be needed.

It would be nice to have a keystroke alias, or a plugin command invoked by a keystroke alias, to do all this automatically. For now I have a keystroke alias which does step 3 - all else must be done manually.
--
Steve
 
Hallo vefatica,


> Is there a way to append the current command line to an @@key alias
> (instead of the default insert/overwrite behavior)? For example,
> alias @@F2=command (?) in such a way that if I type "foo" and then
> press F2, "command foo" is executed?

Not a straightforward one. But I see that @READSCR still exists, which
would allow to put your cmdline intoa var and append t his to your
alias...

Clumsy, I know.

herzliche Grüße,

Klaus Meinhard
 
Nov 2, 2009
294
6
Chile
www.farah.cl
Does anyone use an @@key alias with a command line in progress? ... have a good example?

There's something that, while it's not the exact same thing, it's technically close:

On Unix shells, typing ^L will clear the screen while keeping in the command line whatever has been typed. I have an @@^L=cls alias, but it doesn't work the same way (something that drives me, the detailed-obsessed maniac, nuts).

I'd love to be able to clear the screen in this manner in TCC.
 
Similar threads
Thread starter Title Forum Replies Date
SeoulBigChris Does TC intercept the APPEND command? Support 7
M Can "append to clipboard when shift is held down" be disabled? Support 1
R How to? Append files in multiple subfolders using copy? Support 8
samintz WAD Copy/append adds a character Support 3
vefatica Append something entered to a file? Support 12
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
J Take command does not start on Windows 10 Support 3
vefatica `Back quotes` - command line vs. batch file Support 5
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 7
Phileosophos Command-line Editing Shortkeys That Fail Support 6
fpefpe How to? free (internal) command Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
T How to? retain command history across reboot? Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
Jay Sage Take Command Is Too Fast! Support 4
Jay Sage Comparison of IF with Command Group and IFF Support 6
D Open Windows 10 Photos app from command line Support 11
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
U Can not get/start Take Command gui Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
S Increasing Font Point Size in Command Tabs Support 2
mfarah Fixed The DATE command produces the wrong error message. Support 1
vefatica Command name mix-up Support 3
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
E How to? Closing desktop created by DESKTOP command Support 10
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
K Take Command fox XP? Support 7
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
fpefpe How to? command echo in title line/bar Support 2
U Command help on file names Support 5
vefatica Command line DO with no closing parenthesis? Support 9
vefatica Command history search is off Support 7
H How to? How can I say "if the command separator is not ~ then setdos /C~" Support 8
N Command execution slows down in TCC Prompt after a while Support 6
R Long commands retrieved from command history have blank line when wrapped Support 20
jpeni Take Command Language Examples Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
fpefpe winfr command Support 4
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
M Selecting test "off by one" problem in Take command Support 4
Dmitry L. Kobyakov Documentation Error in the Help: the WINDOW command Support 0
R How to? Open Take Command at current folder Support 7
rconn News Take Command / TCC / CMDebug / TCC-RT 26.01.40 uploaded Support 0

Similar threads