Skip to content

Screen and Window

Ravbug edited this page Jan 18, 2019 · 1 revision

Screen

You can get information about the screen, or screens, connected to the computer. Which may be important for controlling mouse pointers and stuff like that.

Use “Screen” to refer to the primary monitor, or use “Screen” followed by a number to refer to individual screens.

Orientation

In theory you can now set the screen orientation. It doesn’t work for me, but that might just be nvidia’s, or Vista’s fault. Use it like this:

Screen.Orientation = 90 degrees

You can only rotate the screen by a multiple of 90 degrees.

Scrolling the entire screen

Wallpaper must be switched off and set to a solid colour for this to work!

This is mostly used for Virtual Reality Head Mounted Displays, but it may also be useful for other purposes. It shifts the entire screen contents in any direction, exposing new desktop space. This allows you to create a much larger virtual desktop that you can pan around, and spread windows over.

It is buggy, but still very cool. With a HMD you could be surrounded by a 360 degree desktop. You could then drag windows all around you and place them at points in space.

Use Screen.ScrollX and Screen.ScrollY, they are measured in pixels.

Size

Screen.Width is the width in pixels, but you can also get the width in real units by writing something like:

debug = Screen.Width in cm

The Physical width will only be right for a single Plug and Play monitor you have connected.

Screen.Height is the height in pixels. You can also get the real units.

Screen.PhysicalWidth is a better way of getting the screen width in physical units.
Screen.PhysicalHeight is the same for height.

Screen.ViewableSize is the actual viewable size of the monitor. If it is a CRT monitor then it will be less than the advertised size, because the advertised size is always the size of the tube itself rather than the viewable area. If it is an LCD monitor, then it will be about the right size.

Screen.PixelsPerInch is the number of dots per inch that your monitor has.

Screen.WorkAreaWidth and Screen.WorkAreaHeight is the size in pixels of the work-area, which is all of the screen that isn’t covered up with the task-bar and other bars.

Screen.DesktopWidth and Screen.DesktopHeight are the size in pixels of the Virtual Desktop, which stretches across all monitors in a multiple monitor setup.

Position

Screen.Left is the position of the left hand side of the screen in pixels, relative to the top left corner of the primary monitor. So for screen1 it will be 0, but for screen2 it may be something else.
Screen.Top is the position of the top of the screen in pixels, relative to the primary monitor.
Screen.Right is the position of the right hand side of the screen in pixels, relative to the primary monitor.
Screen.Bottom is the position of the bottom of the screen in pixels, relative to the primary monitor.

Screen.DesktopLeft is the position of the left hand side of the virtual desktop relative to the top left corner of the primary monitor. etc.

Screen.WorkAreaLeft is the position of the left hand side of that screen’s work area (the parts not covered by the taskbar). etc.

Plug & Play Monitor Stuff

These only work for a single Plug & Play monitor.

PlugAndPlayAvailable, ManufactureDate, EDIDVersion, EDIDRevision, PhysicalWidth, PhysicalHeight, VendorCode, ProductCode, VendorShortName, VendorLongName, SerialNumber, IsProjector, ViewableSize 

ScreenSaver stuff

ScreenSaverEnabled, ScreenSaverRunning, ScreenSaverTimeout

GlovePIE stuff

IsPieScreen, PieScreen

Other Stuff

There’s lots of other stuff in the Screen object, mostly control panel settings.

Window

The Window object gives you information about the currently active window. It is useful to find out which application is currently active, what size it is, and where it is.

The Window’s title can be read like this:

Window.Title

You can also read specific parts of the title:

Window.BeforeDash
Window.AfterDash
Window.AppName
Window.FileName

You can read the window class name like this:

Window.Class

You can read its size like this:

Window.Width
Window.Height
Window.ClientWidth
Window.ClientHeight

You can read its position like this:

Window.Left
Window.Top

Many of the properties of the Window object are useless or don’t work. It is a work in progress.

Clone this wiki locally