seaver has asked for the wisdom of the Perl Monks concerning the following question:

I want to give my magick script the ability to draw an image that will always be relative to the screen resolution, so I'm writing to ask if anyone knows of a way of 'getting' screen resolution.. thanks S

Replies are listed 'Best First'.
Re: screen resolution
by jepri (Parson) on Sep 06, 2002 at 17:29 UTC
    If you can tell us what kind of a screen you are thinking of, and what operating system you are running, we will be able to help you a little better.

    My general advice is to not start down that path. Put the image in a window and tell the user to resize it so the image is a comfortable size.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: screen resolution
by peschkaj (Pilgrim) on Sep 07, 2002 at 16:05 UTC
    If you are doing this for the web (I don't want to assume terribly much), you could look into SVG (at CPAN: SVG and the spec: W3C SVG 1.0). It's fairly simple and XML based, plus there is a very strong developer community.

    If you make something idiot-proof, eventually someone will make a better idiot.
    I am that better idiot.
Re: screen resolution
by mojobozo (Monk) on Sep 06, 2002 at 17:11 UTC
    Granted this isn't perl code, but here's how you can do it using VBScript:
    '&width='+screen.width+'&height='+screen.height+'&color_depth='+screen +.colorDepth+'
    Maybe find a way to combine it with perl...
    _____________________________________________________
    mojobozo
    word (wûrd)
    interj. Slang. Used to express approval or an affirmative response to
    something. Sometimes used with up. Source
      Good joke. ++. I've got this mental picture of a programmer holding a giant mallet, screaming "Why won't you combine!?!" and bashing the computer with it. :)

      Update: s/fit/combine/

      ____________________
      Jeremy
      I didn't believe in evil until I dated it.

Re: screen resolution
by hacker (Priest) on Sep 07, 2002 at 12:15 UTC

    TMTOWTDI

    use strict; print "Enter your monitor's resolution?\n"; chomp ($_ = <>); $_ = /^\s*(\d+)\s*x\s*(\d+)\s*/i or die; print "The resolution is $1 x $2\n";

    If you're using a browser, why not just dump some Javascript in there, like this:

    <script language="JavaScript"> var width = window.screen.availWidth var height = window.screen.availHeight alert(width + "*" + height) </script>

    Consult the Netscape and Microsoft object model documentation on the following properties:

    screen.width screen.height screen.availWidth screen.availHeight document.body.clientWidth document.body.clientHeight