Sign in to follow this  
Followers 0
Gabriel13

Keep Windows Clear of Top Taskbar

1 post in this topic

This is a script I've been using for a while – I prefer my Windows XP setup with the taskbar on top, but unfortunately there are numerous Windows programs which assume the taskbar will always be on the bottom.

As a result, those programs often place their windows with title bars directly underneath my taskbar – requiring a lot of repeated hassle to get those windows out from under it.

This script takes care of this problem for you – I leave it running all day, and it automatically moves any badly-placed windows out from under the taskbar for me. I'm hopeful that others will also find this little program useful!

opt('mustDeclareVars',1)

func fixWindows($aWinList,$nWidth,$nHeight)
    for $i=1 to $aWinList[0][0]
        local $hwnd=$aWinList[$i][1]
        local $pos=winGetPos($hwnd)
        if isArray($pos) then
            local $x=$pos[0],$y=$pos[1],$winWidth=$pos[2],$winHeight=$pos[3]
            if $x<=0 and $y<=0 and $winHeight>=(@DesktopHeight-4) then
                ; don’t move this window – something covering the whole screen is probably meant to be there
            elseif $x<$nWidth and $y<$nHeight then
                ; move this window out from under the taskbar
                winMove($hwnd,"",$x,$nHeight)
            endif
        endif
    next
endfunc

func start()
    local $aTaskbarPos,$trayWidth,$trayHeight

    do
        sleep(2000) ; check every two seconds
        $aTaskbarPos=winGetPos('[CLASS:Shell_TrayWnd]')
    until isArray($aTaskbarPos)

    if $aTaskbarPos[1]>0 then
        ; taskbar is not at the top of the screen, quit
        exit
    endif

    $trayWidth=$aTaskbarPos[0]+$aTaskbarPos[2]-32 ; allow for windows mostly on the other side of the taskbar (for dual monitor setup)
    $trayHeight=$aTaskbarPos[1]+$aTaskbarPos[3]-4

    while true
        sleep(2000) ; check every two seconds
        fixWindows(winList(),$trayWidth,$trayHeight)
    wend
endfunc

start()

keepWindowsClearOfTopTaskbar.7z


[url='http://www.autoitscript.com/forum/index.php?showtopic=104150']JSON UDF Library (fully RFC4627-compliant)[/url][url='http://www.autoitscript.com/forum/index.php?showtopic=104325']Keep Windows Clear of Top Taskbar (for those who like their taskbar on top)[/url]

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0