ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: move around windows with keys + extra feature

(1/2) > >>

brotherS:
Hi!

I don't remember where exactly I found this great script, maybe it's even skrommel's code :)

It works perfectly, I just miss ONE feature. The script should not only move the window but the mouse cursor with it, to prevent that the window would move away from beneath the cursor.

Thanks in advance! :up:


--- ---;move active window around with Windows+l/r/up/down
; move active window xx pixels right
#right::
   wingetpos x, y,,, A   ; get coordinates of the active window
   x += 30           ; add this distance to the x coordinate
   winmove, A,,%x%, %y%  ; make the active window use the new coordinates
   return              ; finish

; move active window xx pixels left
#left::
   wingetpos x, y,,, A
   x -= 30
   winmove, A,,%x%, %y%
   return

; move active window xx pixels up
#Up::
   wingetpos x, y,,, A
   y -= 30
   winmove, A,,%x%, %y%
   return

; move active window xx pixels down
#Down::
   wingetpos x, y,,, A
   y += 30
   winmove, A,,%x%, %y%
   return

Carol Haynes:
You use MouseGetPos and MouseMove in each secition to acheive your goal? You also need to add a condition to stop the window disappearing off the screen area too (unless that's what you want).

I have changed it to Control+Windows+arrow so that you don't lose access to the Windows key.

;move active window around with Ctrl+Windows+l/r/up/down
; move active window xx pixels right
^#right::
   wingetpos x, y,,, A   ; get coordinates of the active window
   x += 30           ; add this distance to the x coordinate
   mousegetpos, mx, my
   winmove, A,,%x%, %y%  ; make the active window use the new coordinates
   mousemove, %mx%, %my%
   return              ; finish

; move active window xx pixels left
^#left::
   wingetpos x, y,,, A
   x -= 30
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%
   return

; move active window xx pixels up
^#Up::
   wingetpos x, y,,, A
   y -= 30
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%
   return

; move active window xx pixels down
^#Down::
   wingetpos x, y,,, A
   y += 30
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%
   return

brotherS:
CarolHaynes: thanks! :)

It works perfectly, but is there a way to speed it up? I can't more around windows as fast as before, there's a noticeable delay when hitting a hotkey often (to move it to the other side of the screen) and sometimes the script 'swallows' one of the key presses then...

Carol Haynes:
This version seems to be a bit quicker. But you may want to see if you could increase the step size the longer the key is held - that would really make it customizable  :up:

Skrommel - any idea how to do that?

;move active window around with ctrl+Windows+l/r/up/down
; move active window xx pixels right
^#right::
   wingetpos x, y,,, A   ; get coordinates of the active window
   x += 30           ; add this distance to the x coordinate
   mousegetpos, mx, my
   winmove, A,,%x%, %y%  ; make the active window use the new coordinates
   mousemove, %mx%, %my%, 0
   return              ; finish

; move active window xx pixels left
^#left::
   wingetpos x, y,,, A
   x -= 30
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%, 0
   return

; move active window xx pixels up
^#Up::
   wingetpos x, y,,, A
   y -= 30
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%, 0
   return

; move active window xx pixels down
^#Down::
   wingetpos x, y,,, A
   y += 30
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%, 0
   return

brotherS:
Right, that IS faster, nice! :up:

Let's see if Skrommel has anything to add :)

Navigation

[0] Message Index

[#] Next page

Go to full version