Windows 7 Taskbar Width & Height Information

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Windows 7 Taskbar Width & Height Information

Post by Rain » Tue Oct 18, 2011 4:35 pm

The script was written and successfully tested in Windows 7 Ultimate. It may also work in Vista but I don't have Vista to test.
Test was unsuccessful in Windows XP Pro because Windows XP doesn't have a User Promoted Notification Area, which this script is looking for to retrieve the taskbars width and height.

Windows 7 Taskbar Width & Height

Code: Select all

//Get Taskbar dimensions 
GetScreenRes>ScreenWidth,ScreenHeight

Let>WIN_USEHANDLE=1

GetWindowHandle>User Promoted Notification Area,handle
Repeat>TaskbarWidth
   Sub>handle,1
   GetWindowSize>%handle%,TaskbarWidth,TaskbarHeight
Until>TaskbarWidth=ScreenWidth

Let>WIN_USEHANDLE=0

//Subtract Taskbar Height from Desktop Height
GetScreenRes>DesktopWidth,DesktopHeight
Let>DesktopHeight=DesktopHeight-TaskbarHeight

Let>MSG_WIDTH=300
Let>MSG_HEIGHT=250
//Display Real screen, Taskbar and desktop dimensions without the Taskbar.
MessageModal>Screen Width With Taskbar: %ScreenWidth%%CRLF%Screen Height With Taskbar: %ScreenHeight%%CRLF%%CRLF%Taskbar Width: %TaskbarWidth%%CRLF%Taskbar Height: %TaskbarHeight%%CRLF%%CRLF%Desktop Width Without Taskbar: %DesktopWidth%%CRLF%Desktop Height Without Taskbar: %DesktopHeight%


Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts