Jump to content

Dock Windows Left & Right


muncherw
 Share

Recommended Posts

I like the way, in Windows 7, that you can drag a window to either side of the screen and it will make it take up half the window. Since I don't have Windows 7, this is what I made for myself. Have this run in the background and then move your windows.

 

#include <Misc.au3> 
  Opt("WinTitleMatchMode", 4);1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
    
  $TaskPos = ControlGetPos("classname=Shell_TrayWnd", "", "ToolbarWindow322")
  $size = WinGetPos("[active]")
  
  While 1
      $size = WinGetPos("[active]")
      Sleep(25)
      If $size[0] < -50 Then;Dock the left side
          MouseUp("left") ;Stop the user from dragging the window
          WinMove("[active]", "", 0, 0, @DesktopWidth / 2, @DesktopHeight - $TaskPos[3])
      EndIf
  
      If $size[0] + $size[2] > @DesktopWidth + 50 Then;Dock the right side
          MouseUp("left") ;Stop the user from dragging the window
          WinMove("[active]", "", @DesktopWidth / 2, 0, @DesktopWidth / 2, @DesktopHeight - $TaskPos[3])
      EndIf
  WEnd
 

Edit:Removed unnecessary code.

Edited by muncherw
Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

Interesting but I think you need to cater for those people with the task bar docked somewhere other than the bottom of the window. You might also take a look at http://maxto.net/ which has some interesting options for maximising windows.

WBD

Link to comment
Share on other sites

Interesting but I think you need to cater for those people with the task bar docked somewhere other than the bottom of the window. You might also take a look at http://maxto.net/ which has some interesting options for maximising windows.

WBD

Yeah, you are probably right. I should probably have it remember the size of the window so when you move it back it goes to the old size.

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

SplitMon has some nice features to move windows around. It even supports multiple screens.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks munch, it works fine on this end. I'll pass on buying Win7 now. :D

BTW, I think you can lose the "user32.dll" -stuff unless you have something else up your sleeve.

Keep on codin'!

Oh yeah. I was trying to use ispressed before but then realized it didn't serve my needs.

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

.... and what about

MouseUp("left")

??

8)

When you drag the window to the place that triggers resizing and moving the window, if you are still holding the mouse down you will fight move and the window will flicker as it changes back and forth from where you are dragging to what it's trying to resize to. Simply making it think you let go of the mouse button will stop that from happening.
Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...