Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Win7: shake
#1
Ok, so here's the first of "Let's make QM mimic Win7 functions".

There's a new function in Win7 that allows you to see the desktop (min all other progs, maybe) whenever you grab a window and shake it. I was messing with this in the mouse triggers but it doesn't seem to trigger when you have the mouse button held down.

Can that be added without a lot of hassle? I wouldn't use it per se but I was curious.

Thanks.
An old blog on QM coding and automation.

The Macro Hook
#2
The macro could have mouse click trigger with unchecked 'when released'. It waits for mouse up... Also need to track mouse path... Difficult.
#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
#4
HA! that's awesome! I was thinking of the very same thing when I saw those vids.

I'm wondering if instead of maximizing the screen, making the window take up the full screen. That way you can still grab it and move it around if you need to.
An old blog on QM coding and automation.

The Macro Hook
#5
Great code! Thanks. Simple and elegant.
I added the "res" command before the "siz" in the half screen windows. Leaving the window's maximized at half screen size lead to odd behavior.
Matt B
#6
edit: I figured out my problem, question removed.


Forum Jump:


Users browsing this thread: 2 Guest(s)