Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Programatically retrieve the line the cursor is in in TCC (not TCMD)

Jun
223
0
Is it possible to programmatically retrieve the line the console cursor is in/a specific line (NOT the current input line!) in TCC?
 
Is it possible to programmatically retrieve the line the console cursor is in/a specific line (NOT the current input line!) in TCC?
Batch/BTM? ... _ROW and _COLUMN (or have I misunderstood the question?)
 
Sorry, I was unclear...

Consider the following screen content:
Code:
13.09.2012  12:36        <DIR>    ____D__________                  WINUSB
14.05.2013  15:35     15.602.230  ___A___________  ARCHIV~1.EXE    ArchivInstall_1.0.10.2.exe
16.01.2012  18:36         50.023  ___A___________  CONFIG~1.MAF    Configurable Language and Cultural Settings.maff
10.07.2013  10:43      2.392.064  ___A___________  PSCX-3~1.MSI    Pscx-3.0.0.msi
03.06.2011  14:40      6.215.646  ___A___________  GR-KAB~1.PDF    GR-KabelKatalog2011.pdf

Now, when pressing a defined key, with the cursor being e.g. on "Pscx-3.0.0.msi", a program would start that - depending on the file type (here msi) - would handle file "Pscx-3.0.0.msi" (preferably in a way configurable through some config file).

Would this be possible through a BTM file or a plugin? I've already implemented such a behavior for Firefox (with Vimperator) and vi itself. Would be a nice thing to have as it would lead to a "leaner" workflow: Instead of selecting "Pscx-3.0.0.msi", copying it, pasting it into the command line, and prefixing it with a command, I would simply have to position the cursor and press a key (sometimes I long for my good old BS2000..., which brings me to an alternative: What about having the possibility to edit the console output directly, and start commands from the edited area?).
 
How would you get the cursor there? I'd expect the cursor to be at the end of a new prompt, or at a "more" prompt. Are we talking about the console cursor (insertion point) or the mouse pointer?
 
In any action related to screen position it makes a critical difference whether you are in a TCMD tab or in a stand alone TCC window. I just tested TCC 15.01.52 in its own window; without using the console host's EDIT function there is only ONE cursor when at the command prompt, right where a new command can be entered, so such feature, if possible at all, is only for the case when TCC is in a TCMD tab. I don't use TCMD, so I desist from further participation in this thread.
 
It's about TCC, and (the begin of) a selected area - set with a left mouse click.
If you're in TCMD, there's the variable _SELECTED.
The builtin Windows console selection mechanism (mouse) and TCC's mechanism (keystrokes) are independent and I'm pretty sure each knows nothing about the other. The WIN32 API has GetConsoleSelectionInfo() which will return info on a selection made with the Windows mouse-mechanism (I don't know about the TCC mechanism). But I doubt you'll team that up with a keystroke because keystrokes take a console out of selection mode.

After selecting with the mouse, right-click copies to the clipboard and de-selects. A TCC keystroke alias (@@key) could then reference @CLIP[0] and do whatever you wanted. That adds an extra step but may be the best you can do.
 
How would you get the cursor there? I'd expect the cursor to be at the end of a new prompt, or at a "more" prompt. Are we talking about the console cursor (insertion point) or the mouse pointer?

Easy! Rex just needs to convert TCC's line editor into a screen editor, a la the Commodore 64. Merely a small matter of programming! (grinning, running, and ducking)
 
If you're in TCMD, there's the variable _SELECTED.

Stupid question here, how are you intended to use that variable? As soon as you try to type something in TCMD after selecting a part of the tab window text, the selection is cleared and %_selected contains nothing. Using Command Input windows did not seem to pick it up either.
 
Stupid question here, how are you intended to use that variable? As soon as you try to type something in TCMD after selecting a part of the tab window text, the selection is cleared and %_selected contains nothing. Using Command Input windows did not seem to pick it up either.
Perhaps _SELECTED refers to something selected in one of the GUI windows; I didn't check.
 

Similar threads

Back
Top