Sign in to follow this  
Followers 0
muncherw

Dock Windows Left & Right

8 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
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

Share this post


Link to post
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]

Share this post


Link to post
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'!

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

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

.... and what about

MouseUp("left")

??

8)


NEWHeader1.png

Share this post


Link to post
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]

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