Get height of windows-taskbar

Asked by Steffen

Hi, is it possible to get the height of the windows taskbar?
My goal is to get the region of a maximized window - but without the windows-taskbar.
I don't want to use find("windows-icon.png") because my script shall run on different (windows-)systems.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

You could open an application, whose foreground window is easy to get, maximize it (alt-blank (window menu), alt-maximize) and ret the window's region.

e.g.
openApp("notepad")
wait(3)
# now make the type()'s to maximize the window
wait(1)
w = App.focusedWindow()
print "width", w.w
print "height", w.h

Revision history for this message
Steffen (steffen-be) said :
#2

Resolution of my monitor: 1920x1080

I ran this script:
openApp("notepad")
wait(3)
type(" ",KeyModifier.ALT)
for i in range(4):
    type(Key.DOWN)
type(Key.ENTER)
wait(1)
w = App.focusedWindow()
print "x", w.x
print "y", w.y
print "width", w.w
print "height", w.h

print results:
x -8
y -8
width 1936
height 1056

Why is there a "border" of 8px around my App ?

Revision history for this message
RaiMan (raimund-hocke) said :
#3

interesting, did not know that:
It seems, that when using the window menu maximize feature, the the left, right and bottom window borders are "outside of the screen.

You can check that: if you manually enlarge the window by dragging the edges, the borders stay visible (inside the screen region) and the window has the width of the screen.

Using the maximize window function from the menu the borders are not visible (outside of the screen).

And what is another "problem": the top left corner is (-8. -8).
So I thank you for this finding: I am working at the next Sikuli release now and have partly revised the Screen/Region concept. I have to check, what happens, if you use this window as a region (the intersection of the window and the screen should be taken).

Revision history for this message
RaiMan (raimund-hocke) said :
#4

I have to correct:
The defined border size (8 in the standard) is outside the screen in this case at all 4 edges (the bottom border is behind the task bar if it is always visible)

Revision history for this message
Steffen (steffen-be) said :
#5

But is the border-size _always_ 8px, or does it depend on screen resolution, which app is opened, etc.?

Revision history for this message
RaiMan (raimund-hocke) said :
#6

depends on the Windows outfit setup.

Can you help with this problem?

Provide an answer of your own, or ask Steffen for more information if necessary.

To post a message you must log in.