Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Win7: shake
#3
Ken, it looks like we think alike!!!!! (Lifehackers!!!!!!)

I saw the window resizer clip on LH (Windows 7 Half-Size Left/Right Snap and Top Max)
http://lifehacker.com/5077728/snap-any-w...-windows-7
and thought "now that's a job for QM"!

Here is my stab at it (with comments). I cross posted this to the LifeHacker forum with a plug for QM and the forum (see below).

Function Window7_Resizer
Trigger #Lh2 0x8     Help - how to add the trigger to the macro
Code:
Copy      Help
;; macro triggered by left click on any windows "caption" bar i.e. top title bar. In properties, select Trigger-->Mouse-->Click-->Left. "Eat" should be checked. "When Released" should be unchecked. Under hit test, select "Caption". (Alternatively, you can just paste  #Lh2 0x8 into the trigger edit box on the toolbar). You can also make this a right click action: Select Right Click in properties and change "wait 2 ML;err" to "wait 2 MR;err".

int WinUnderMouse_Hwnd = win(mouse);;get window handle of window under mouse when macro triggered by mouse click
lef+ ;;left click down to start dragging
wait 2 ML;err ;; wait at most 2 sec for click to be released. If click release doesn't come earlier, then move forward to next (release) step  
lef- ;; release left click which releases hold on window


int WinX= xm;; get x coordinate at time of release
int WinY=ym;; get y coordinate at time of release

int DeskTopWidth = ScreenWidth;;gets screenwidth

if WinY = 0;; i.e. the user dragged the window to the top of the screen
,max WinUnderMouse_Hwnd;;maximize the dragged window
,ret;;end macro

,
if WinX = 0 ;; if user drags to Left Screen Border, halves screen and places on left
,siz 0.5 1.0 WinUnderMouse_Hwnd 4;; 0.5 width, 1.0 height (flag 4 means these are relative to the workspace)
,mov 0 0 WinUnderMouse_Hwnd 4;;move the window to left side of screen
,ret;; end macro
;rig    
,
if WinX = DeskTopWidth-1 ;; if user drags to Left Screen Border, halves screen and places on left (note 1 pixel correction)
,siz 0.5 1.0 WinUnderMouse_Hwnd 4;; 0.5 width, 1.0 height (flag 4 means these are relative to the workspace)
,mov 0.5 0 WinUnderMouse_Hwnd 4;;move the window over halfway (0.5) across the screen
,ret;; end macro


,


My Lifehacker post: http://lifehacker.com/5077728/snap-any-w...-windows-7


Quote:8:51 AM
I wrote a short little script in QuickMacros2(http://www.quickmacros.com) that can do both the right and left docking and the topscreen max function.
I will paste the code with comments below. Check out QM..even a relative newbie can do anything their imagination comes up with and there's a ton of samples and an extraordinarily responsive program author and great user community at the forumhttp://www.quickmacros.com/forum./ Happy Scripting!!!!, Stuart

;; macro triggered by left click on any windows "caption" bar i.e. top title bar. In properties, select Trigger-->Mouse-->Click-->Left. "Eat" should be checked. "When Released" should be unchecked. Under hit test, select "Caption". You can also make this a right click action: Select Right Click in properties and change "wait 2 ML;err" to "wait 2 MR;err".

int WinUnderMouse_Hwnd = win(mouse);;get window handle of window under mouse when macro triggered by mouse click
lef+ ;;left click down to start dragging
wait 2 ML;err ;; wait at most 2 sec for click to be released. If click release doesn't come earlier, then move forward to next (release) step
lef- ;; release left click which releases hold on window

int WinX= xm;; get x coordinate at time of release
int WinY=ym;; get y coordinate at time of release

int DeskTopWidth = ScreenWidth;;gets screenwidth

if WinY = 0;; i.e. the user dragged the window to the top of the screen
,max WinUnderMouse_Hwnd;;maximize the dragged window
,ret;;end macro

,
if WinX = 0 ;; if user drags to Left Screen Border, halves screen and places on left
,siz 0.5 1.0 WinUnderMouse_Hwnd 4;; 0.5 width, 1.0 height (flag 4 means these are relative to the workspace)
,mov 0 0 WinUnderMouse_Hwnd 4;;move the window over halfway (0.5) across the screen
,ret;; end macro
;rig
,
if WinX = DeskTopWidth-1 ;; if user drags to Left Screen Border, halves screen and places on left (note 1 pixel correction)
,siz 0.5 1.0 WinUnderMouse_Hwnd 4;; 0.5 width, 1.0 height (flag 4 means these are relative to the workspace)
,mov 0.5 0 WinUnderMouse_Hwnd 4;;move the window over halfway (0.5) across the screen
,ret;; end macro


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)