Hotkey-mechanism, for doing something with the current command-line

Aug 12, 2014
13
0
#1
Is there a way within TC to connect a hotkey to a self-written program, which could able to analyze the currently-written command-line (as input) and simulate some key-strokes (as output)?

Like e.g. the TAB-key-functionality, which checks the current argument of the currently-written command-line and tries to find an existing file/dirname which has the current-arg as a prefix and (kind of) simulates the key-strokes, so that this file/dirname is expanded. Or it's behaviour, if TAB is entered again (=> switching to the next matching file/dirname).

Or the arrow-up/down keys, which check the history.

Specifically (as a first shot) I would like to have a hotkey which would duplicate the former argument of the current command-line. Or have a way to let TC popup a messagebox, which would show me the syntax of the exe-file I am about to call in the current-line.

[This is a more general question, than the one I recently asked in the BDJ-conversation, but somehow could not make me enough understandable. Perhaps more luck this time...]
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,602
46
Albuquerque, NM
prospero.unm.edu
#2
Possibly this might be of use to you: http://prospero.unm.edu/plugins/ekeys.html

It's a generic plugin for defining hotkeys which grab the word at the cursor and "do stuff" to it. "Do stuff" generally means running the word through a function; I suppose the function could be @EXEC or @EXECSTR though I haven't messed with that idea much.
 
Likes: Michael R
Aug 12, 2014
13
0
#3
Thanks Charles, for your answer and your plugin.

Specifically (as a first shot) I would like to have a hotkey which would duplicate the former argument of the current command-line.
I already embedded EKeys into my TC.

Specifically (as a first shot) I would like to have a hotkey which would duplicate the former argument of the current command-line.
Doing this was quite easy
ekey alt-d=# #

Doing stuff, that needs information about the other args in the current command-line or accessing to the history is not possible with Ekeys.
Perhaps it would be useful, to have a mechanism in Ekeys, which would allow to call an external command (exe-file), which is provided (as input) with the current command-line args and delivers (as output, i.e. as replacement-string) the replacement-arg (or even the replacement-command-line).

I'm curious about the final version and the source-code, you said you might provide too. Thanks again!
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,602
46
Albuquerque, NM
prospero.unm.edu
#4
Perhaps it would be useful, to have a mechanism in Ekeys, which would allow to call an external command (exe-file), which is provided (as input) with the current command-line args and delivers (as output, i.e. as replacement-string) the replacement-arg (or even the replacement-command-line).
I think that's doable, but will require quite a bit of work. When I have some free time -- meaning probably not for a few weeks.

Can you give an example or two of how it might work and what you would use it for?
 
Aug 12, 2014
13
0
#5
Can you give an example or two of how it might work and what you would use it for?
As said above, at first I might use it o display the syntax of the exe/bat-file which I am about to execute (by analyzing the very first parameter). The output could be done in a message-box or the status-line of the TCC-window.

As a follow-up idea, I would perhaps again analyze the very first argument, the exe/bat-file to be executed and would extend the current partially entered-argument dependent to what it is, e.g. if it is an option with each hotkey-entering all the available options with the just entered prefix-could be replaced, similar as that what the tab-key does with filenames.