Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: How can I increase the cmd.exe screen size permanently - by Perly

by BrowserUk (Patriarch)
on Apr 02, 2012 at 07:57 UTC ( [id://962978]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How can I increase the cmd.exe screen size permanently - by Perly
in thread How can I increase the cmd.exe screen size permanently - by Perly

Have you heard of the more command? Try typing help more

Messing with the user's screen in order to display your long usage message is a bad idea.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^4: How can I increase the cmd.exe screen size permanently - by Perl
by roteme (Acolyte) on Apr 05, 2012 at 13:22 UTC

    Sorry to nag - but I run the following code:

    use strict; use warnings; use Win32::Console; my $OUT = Win32::Console->new(STD_OUTPUT_HANDLE); my $IN = Win32::Console->new(STD_INPUT_HANDLE); $IN->Mode(ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT); $OUT->Size(180, 200); my ($maxx, $maxy) = $OUT->MaxWindow; $OUT->Cls; $OUT->Cursor(-1, -1, -1, 0); $OUT->FillAttr($BG_YELLOW|$FG_BLUE, $maxy * $maxx, 0, 0); $OUT->FillChar('X', $maxy*$maxx, 0, 0); $OUT->Window(1, 0, 0, $maxx, $maxy); while ($maxx>1 and $maxy>1) { $maxx -= 5; $maxy -= 5; $OUT->Window(1, 0, 0, $maxx, $maxy); sleep 1; } $OUT->Window(1, 0, 80, 50); $OUT->Cls;

    Indeed, the screen size is dynamically variable - but if I remove/mark the sleep command than I can't see the screen resize.

    I Would love to know what I was doing wrong, how can I make my current screen resize to 80*100 and stay on this size?

    Mode command I used is good indeed, the only problem is that it disappear the buffer size and the user can't scroll the screen up and down

    Thanks.

      Indeed, the screen size is dynamically variable - but if I remove/mark the sleep command than I can't see the screen resize.

      And that is a problem because?

      Perhaps you what to see it resize in steps, but with the sleep in there it takes too long, and without the sleep it happens so fast you don't see the intermediate positions?

      If so, replace the sleep 1; with Win32::Sleep 100;; Adjust the number to suit.

      I Would love to know what I was doing wrong, how can I make my current screen resize to 80*100 and stay on this size?

      If you want to unconditionally change the screen size to 80x100, the try:

      perl -MWin32::Console -e"Win32::Console->new(STD_OUTPUT_HANDLE)->Windo +w(1, 0, 0, 50,50);"

      But realise that the call will fail if you try to size the window so that some part of it will be outside of the screen:

      C:\test>perl -Mstrict -MWin32::Console -we"Win32::Console->new(STD_OUT +PUT_HANDLE)->Window(1, 0, 0, 50,500) or die $^E;" The parameter is incorrect at -e line 1.

      In the above, the 'right' dimension specified (500) is bigger than my screen can handle with the currently selected font/size, so the call fails with "The parameter is incorrect".

      See SetConsoleWindowInfo() for more info on this.

      The thing to note here is that:

      • ->Size( x, y ) specified the size of the Screen buffer, which can be huge 1000x1000 at least.
      • ->Window( flag, top, left, bottom, right ); decides how big the window is.

      This might get you started:

      #! perl -slw use strict; use List::Util qw[ max min ]; use Win32::Console; my $OUT = Win32::Console->new(STD_OUTPUT_HANDLE); my $origAttr = $OUT->Attr; $OUT->Cls; $OUT->Size(1000, 1000); my ($maxx, $maxy) = $OUT->MaxWindow; $OUT->Window( 1, 0, 0, $maxx-1, $maxy - 1 ); my $striped = chr( $FG_BLUE | $BG_WHITE ) . chr( $FG_LIGHTBLUE | $BG_L +IGHTGRAY ); for my $row ( 1 .. 1000 ) { $OUT->WriteAttr( $striped x 500, 0, $row ); $OUT->WriteChar( '1234567890' x 100, 0, $row ); } for ( 1 .. 3 ) { for my $n ( 0 .. $maxx - 2 ) { $OUT->Window( 1, min( $maxx-2, $n ), min( $maxy-2, $n ), $maxx +-1, $maxy-1 ) or die $^E; Win32::Sleep 3 - $_; } for my $n ( 0 .. $maxx ) { $OUT->Window( 1, 0, 0, min( $maxx-1, $n ), min( $maxy-1, $n ) +) or die $^E; Win32::Sleep 3 - $_; } } $OUT->Attr( $origAttr ); $OUT->Cls;
      Mode command I used is good indeed, the only problem is that it disappear the buffer size and the user can't scroll the screen up and down

      The mode command sets the size of the buffer.

      It then also sets the size of the screen to (whichever is smaller of) that buffer size, or the maximum the screen can hold.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://962978]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-18 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found