Welcome Guest.   Make a donation to an author on the site October 21, 2014, 07:06:36 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the Practical Guide to DonationCoder.com Forum Search Features
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: move around windows with keys + extra feature  (Read 7055 times)
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« on: September 20, 2005, 08:26:54 AM »

Hi!

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

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! thumbs up

[copy or print]
;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
« Last Edit: March 07, 2006, 02:37:09 AM by brotherS » Logged

Thank you.
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: September 20, 2005, 10:00:14 AM »

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
« Last Edit: September 20, 2005, 10:17:31 AM by CarolHaynes » Logged

brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #2 on: September 20, 2005, 10:38:15 AM »

CarolHaynes: thanks! smiley

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...
Logged

Thank you.
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: September 20, 2005, 10:53:05 AM »

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  thumbs 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
Logged

brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #4 on: September 20, 2005, 11:26:25 AM »

Right, that IS faster, nice! thumbs up

Let's see if Skrommel has anything to add smiley
Logged

Thank you.
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: September 20, 2005, 02:05:31 PM »

 smiley Very useful script if you have a multi monitor system!

And  there's actually a very clever MouseMove in CarolHaynes' version - using the changing relative position to move it back to where it was - I never would have thought of that!

About increasing the move when the key is held down, I'd suggest using A_TickCount and SetTimer to check how long it's been since the last move - long time=decrease, short time=increase.

I still have left to make a really useful script to move the mouse using the keyboard, so I wish you good luck!

There's also plenty of tips to be found at the forums at http://www.autohotkey.com/forum.

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #6 on: September 20, 2005, 02:17:24 PM »

Hi Skrommel smiley

Did you write the original code?

You are right about the AutoHotkey forum but I love the coding snack section of this site! I bet if there would be more pages like that AutoHotkey would get more attention... many seem to confuse it with an alternative to C++ and hate it Sad

Logged

Thank you.
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: September 20, 2005, 02:53:08 PM »

 smiley No, not my code, but I've seen a few like it on AutoHotkey.

And I couldn't agree more on the C note smiley. I once spent a few months making a mouse tool to scroll the screen in C. In AHK it took one evening!

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.032s | Server load: 0.24 ]