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:

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?


In reply to Re^5: How can I increase the cmd.exe screen size permanently - by Perl by BrowserUk
in thread How can I increase the cmd.exe screen size permanently - by Perly by roteme

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.