Another simple question re. Take Command/TCC window witdth in characters...

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Really simple. I'd like to know the current width of the current TCC window in characters (similar to what %_Rows certainly seems to be - I get consistent numbers as I increase/decrease the TCC window height), but I really haven't been able to figure exactly what %_Columns is; when the window is "full width", it returns "83", but no matter how "narrow" I make the TCC window after that it returns "80".
 
#3
Thank you, Rex, that certainly does explain it. But I guess that means that my ultimate goal here (which was to have error messages wrap to the next line on a blank whenever possible rather than in the middle of a word) is unachievable, right?
 
#5
If you're trying to shrink your window below 80 columns (and you get a horizontal scrollbar), then no, you can't do that. There isn't any way to determine the physical size of a window < 80 columns.
If you're trying to shrink your window below 80 columns (and you get a horizontal scrollbar), then no, you can't do that. There isn't any way to determine the physical size of a window < 80 columns.
My 4CONSOLE plugin offers _WINROWS and _WINCOLS which will give the window dimensions, in characters.
Rex, that's so easy to do ... why not put it in a future version of TCC?
 
#6
Vince,

I'm somewhat confused at this point. #1. I do have "4Console" installed (which I though I did and the "?" command verifies), #2 If I search for "_WinCols" in Rex's standard help file, nothing comes up ("No topics found", and that's also true for just "WinCols"; and I just search for "columns" the only even slightly relevant thing that comes up is "_Column", which has absolutely nothing to do with what I'm looking for), #3. I do not find any help (.chm file) for "4Console" so I obviously can't look there, and if I enter "help _wincols" I get "console window columns" (I don't even know where that "help" "comes" from), and finally #4. If I type "Echo %_WinCols", I never get a number less than 80, as Rex would suggest.

- Dan
 
#7
Vince,

I'm somewhat confused at this point. #1. I do have "4Console" installed (which I though I did and the "?" command verifies), #2 If I search for "_WinCols" in Rex's standard help file, nothing comes up ("No topics found", and that's also true for just "WinCols"; and I just search for "columns" the only even slightly relevant thing that comes up is "_Column", which has absolutely nothing to do with what I'm looking for), #3. I do not find any help (.chm file) for "4Console" so I obviously can't look there, and if I enter "help _wincols" I get "console window columns" (I don't even know where that "help" "comes" from), and finally #4. If I type "Echo %_WinCols", I never get a number less than 80, as Rex would suggest.
"?" will only show you a plugin's **commands**. "PLUGIN /V" will show the variables for all plugins. 4CONSOLE comes with a text file showing everything. When you "HELP _WINCOLS" TCC passes it on to plugins; 4CONSOLE recognizes it and responds.

I have no idea why you can't see widths less than 80. I just opened a normal console (80x25) and resized it. I got

Code:
v:\> echo %_wincols %_WINROWS
51 23
 
#8
"?" will only show you a plugin's **commands**. "PLUGIN /V" will show the variables for all plugins. 4CONSOLE comes with a text file showing everything. When you "HELP _WINCOLS" TCC passes it on to plugins; 4CONSOLE recognizes it and responds.

I have no idea why you can't see widths less than 80. I just opened a normal console (80x25) and resized it. I got

Code:
v:\> echo %_wincols %_WINROWS
51 23
I pasted an image into my last post. It looked fine in the composition window, but not in the thread view after it was posted. What's up? Anyway I have attache wincols.png d it to this post.
 

rconn

Administrator
Staff member
May 14, 2008
10,291
90
#10
My 4CONSOLE plugin offers _WINROWS and _WINCOLS which will give the window dimensions, in characters.
Rex, that's so easy to do ... why not put it in a future version of TCC?
Because I think that reducing a console window to < 80 characters is probably the single most useless thing you can do in Windows. I'm mystified by the (thankfully tiny) minority of users who think it's a good idea to have to constantly manually scroll their window back and forth to see their I/O.
 
#11
Because I think that reducing a console window to < 80 characters is probably the single most useless thing you can do in Windows. I'm mystified by the (thankfully tiny) minority of users who think it's a good idea to have to constantly manually scroll their window back and forth to see their I/O.
I do it with some regularity. If I have a batch file monitoring some process and only producing a few characters of output each line, I'll size it down to nearly nothing. But I must admit that when I do that, I have no reason whatsoever to ask how big the console window is.
 
#14
Guys,

Several comments about the above: %_WinCols yields no number for me, ever, less than 80 (somewhat ironically given what Vince says vs. what Rex "suggests" in the above), and, not only that, "Echo %_WinCols" yields a "null" string (i.e., "Echo is OFF") in a stand-alone TCC session, which is certainly not any better if not actually worse. (And Rex, I want to do this because I, like Vince if nobody else so far in this thread, often have very long running batch files (as in many hours) that I run in stand-alone TCC and/or Take Command windows that I keep in the "corner" of screen to kind of "monitor" in the background and that sometimes produce error (or "warning") messages that I want to know the full "details" about just by glancing at the window in the corner of the screen. Put simply, I am quite disappointed if that is not possible because that is, exactly, what I really want to do. (I've been considering putting a "message box" up when that happens, but I haven't yet decided whether to do that because I like the way things are (should be) now: When the batch file has a "problem" it displays the message and then "pauses" until I hit a key of some kind - particularly the "[Esc]" key meaning I want to abort the whole thing, and I'd really rather not have that message box "interrupt" what I am doing at any present moment - I get distracted and lose track of what I am doing very easily.)

So, the only question remaining here is "why doesn't 4Console do what Vince thinks is should do?"

- Dan
 
#15
Because I think that reducing a console window to < 80 characters is probably the single most useless thing you can do in Windows. I'm mystified by the (thankfully tiny) minority of users who think it's a good idea to have to constantly manually scroll their window back and forth to see their I/O.
One reason is poor eyesight - you use low screen resolution, thus blowing up all windows to easy readability. This can reduce the displayable area of a window below 80 columns easily.
 
#16
%_WinCols yields no number for me, ever, less than 80 (somewhat ironically given what Vince says vs. what Rex "suggests" in the above), and, not only that, "Echo %_WinCols" yields a "null" string (i.e., "Echo is OFF") in a stand-alone TCC session
_WINCOLS will be useless in a TCMD tab because TCMD keeps resizing the (hidden) console (and _WINCOLS knows nothing about TCMD; it deals strictly with the console).

If in a stand-alone TCC, _WINCOLS is an empty string, that suggests that 4CONSOLE is not being loaded by your stand-alone TCCs. Without 4CONSOLE loaded, TCC will think there is no variable named _WINCOLS and you'll get an empty string. In a stand-alone TCC, make sure 4CONSOLE is loaded (plugin /i 4console).

The only way I can imagine _WINCOLS failing is if there's **NO** console (a detached TCC) and it's clear you're not doing that. And even then, _WINCOLS would produce a non-empty string (with something meaningless in it). It is utterly simple and it cannot return an empty string:

Code:
INT WINAPI _WINCOLS (WCHAR *psz)
{
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    CSBInfo(&csbi); // GetConsoleScreenBufferInfo on "CONOUT$"
    Sprintf(psz, L"%u", csbi.srWindow.Right - csbi.srWindow.Left + 1);
    return 0;
}
 
#17
Vince,

You are, of course correct, and that totally explains, of course, how both you and Rex can be correct. But that does leave one little (thankfully, now unimportant) question: Before I made my posting that under TCC %_WinCols was returning nothing (i.e., a "null" string) I even went so far as to use the TCMD "Save to file..." menu option to save the session to a file (of course) and I then loaded said file into Notepad and found "Echo %_WinCols", which I then copied from the Notepad "document" into a new TCC session to do everything I could do to ensure that I wasn't making a typing error of some kind due to my general clumsiness and vision issue(s), and I got the results that I indicated. However, I just opened up a "new" TCC session to try various version(s) of the "Plugin" command and all of those version(s) indicated that the all of the plugin(s) were, in fact, being loaded. Being surprised by this, I entered "Echo %_WinCols" and it came back with "80", I narrowed the window and did it again and this time it came back with "24", success!!!! Why the that didn't work in my "original" TCC windows is beyond me at this time; but I don't think it really matters!!! Again, thank you very much! (And Rex, you should remember the "differences" between TCC sessions run in Take Command windows and those that are run standalone! :) )

- Dan