AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

move Winodows
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jack



Joined: 04 Sep 2004
Posts: 77
Location: UK

PostPosted: Wed Oct 06, 2004 7:52 am    Post subject: move Winodows Reply with quote

these key definitions enable you to move the active window around the screen using Windows+Up, Windows+Down, Windows+Left, Windows+Right.

not exactly fancy but, as a keyboard sort of person, i find them very handy.

jack
It's not the despair - I can stand the despair. It's the hope


Code:

; move active window 100 pixels right
#right::
   wingetpos x, y,,, A   ; get coordinates of the active window
   x += 100           ; add 100 to the x coordinate
   winmove, A,,%x%, %y%  ; make the active window use the new coordinates
   return              ; finish

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

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

; move active window 100 pixels down
#Down::
   wingetpos x, y,,, A
   y += 100
   winmove, A,,%x%, %y%
   return
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Wed Oct 06, 2004 8:04 am    Post subject: Reply with quote

Cool, thx jack.

Very Happy
Back to top
Guest






PostPosted: Thu Nov 11, 2004 8:07 pm    Post subject: Um... Reply with quote

Wtf happened to alt+space ~ m? Or do you feel that those extra 300 milliseconds of your life could be spent doing better things? I can see hotkeys for batches or running programs, but extremely basic things like closing a window, switching tasks, or moving windows around using the keyboard have already been made simple enough. Windows already takes up enough resources with it's own shit that we don't need to be filling in the cracks with multiples ways to such trivial things.
Back to top
twwilliams



Joined: 24 May 2004
Posts: 23
Location: Bellevue, WA USA

PostPosted: Thu Nov 11, 2004 8:45 pm    Post subject: Reply with quote

Guest:

Maybe the script doesn't make sense to you. But the essence of tools like AutoHotkey is to personalize the user experience. Alt-Space-M may be something you know and that works well for you.

But maybe Jack prefers to use the Windows key and the cursors.

Maybe he has a programmable keypad that lets him assign single chords like Win-Up to a directional pad, in which case this solution in AutoHotkey would make perfect sense for him.

Regardless of any of these things, I appreciate seeing scripts that do interesting things even if I don't think I'll take advantage of their specific capabilities. I do learn from them, though.
_________________
Tommy
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Atomhrt



Joined: 02 Sep 2004
Posts: 128
Location: Sunnyvale

PostPosted: Fri Nov 12, 2004 12:16 am    Post subject: Reply with quote

twwilliams wrote:
Guest:

Maybe the script doesn't make sense to you. But the essence of tools like AutoHotkey is to personalize the user experience. Alt-Space-M may be something you know and that works well for you.

But maybe Jack prefers to use the Windows key and the cursors.

Maybe he has a programmable keypad that lets him assign single chords like Win-Up to a directional pad, in which case this solution in AutoHotkey would make perfect sense for him.

Regardless of any of these things, I appreciate seeing scripts that do interesting things even if I don't think I'll take advantage of their specific capabilities. I do learn from them, though.


Agreed! Smile

I will often see something in a script that I will use for something else. Keep 'em coming!
_________________
I am he of whom he speaks!
Back to top
View user's profile Send private message
exhueydriver



Joined: 12 Jul 2004
Posts: 51
Location: Fife,Wa

PostPosted: Fri Nov 12, 2004 2:50 am    Post subject: Reply with quote

Anybody who would use profanity in a forum like this, where everyone
is actively trying to help everyone else, doesn't even need to be answered.
My $0.02
Don
Back to top
View user's profile Send private message
jack



Joined: 04 Sep 2004
Posts: 77
Location: UK

PostPosted: Fri Nov 12, 2004 7:01 am    Post subject: Reply with quote

Quote:
Wtf happened to alt+space ~ m?


hmm. yes, if you like that one pixel at a time stuff. it's very slow. and i use a computer a lot.

but you have to do all those keystrokes and then start moving the window.

as for switching tasks, windows is ghastly. autohotkey enables me to have all my common windows on single keys. capslock gets me a file manager (and it's not Explorer!), print screen gets mail, pause gets emacs, rctrl gets web browser (and it's not IE!)...

but i reckon most people use a mouse to move a window anyway. i posted the script merely as light reading for someone who might get an idea from it, not in the expectation that i was going to change the world.


jack
dithering requires more memory
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Nov 15, 2004 4:08 pm    Post subject: Reply with quote

For me, alt+space never made sense. For moving and resizing the window you shouldn't be pressing four different keys, the mouse will always be faster and more natural. The minimize and maximize keys should have straight hotkeys already, (think alt+f4) and alt+space is a stupid hotkey anyway. Very Happy Anyway, great script, I'll see if I can work something like it into my alt+f4 complements script.

P.S. I refuse to dignify the guest's post with a direct response. Huey and Williams have got that covered pretty well.
Back to top
View user's profile Send private message
jtran21
Guest





PostPosted: Tue Nov 23, 2004 12:53 pm    Post subject: Keeping it within window bounds Reply with quote

Liked the code, here are made some slight modifications so that the window won't run outside of the screen area.

Code:

keyboardMoveWindowIncrement=80

#Right::
   WinGetPos x, y, w, h, A   ; get coordinates of the active window
   x += %keyboardMoveWindowIncrement%
   SysGet screensize, MonitorWorkArea
   screensizeRight -= %w%
   If x > %screensizeRight%
      x= %screensizeRight%
   WinMove, A,,%x%, %y%  ; make the active window use the new coordinates
   return

#Left::
   WinGetPos x, y,,, A
   x -= %keyboardMoveWindowIncrement%
   If x < 0
      x=0
   WinMove, A,,%x%, %y%
   Return

; move active window 100 pixels up
#Up::
   WinGetPos x, y,,, A
   y -= %keyboardMoveWindowIncrement%
   If y < 0
      y=0
   WinMove, A,,%x%, %y%
   Return

; move active window 100 pixels down
#Down::
   WinGetPos x, y,w,h, A
   y += %keyboardMoveWindowIncrement%
   SysGet screensize, MonitorWorkArea
   screensizeBottom -= %h%
   if y > %screensizeBottom%
      y= %screensizeBottom%
   WinMove, A,,%x%, %y%
   Return
Back to top
ezuk



Joined: 04 Jun 2005
Posts: 129

PostPosted: Tue Jun 07, 2005 4:03 pm    Post subject: Very useful! Reply with quote

This is a _very_ useful script. I use it to move windows around my multi-monitor system.

I'm actually using the origianl version, which is better suited for this. I might add some code for easily maximizing/restoring the windows using a combo of Winkey + arrows (so you don't have to move your hand too much).

If anyone wants this, drop me a note and I'll put it here when I'm done.
Back to top
View user's profile Send private message
brotherS



Joined: 01 Jun 2005
Posts: 147

PostPosted: Mon Aug 29, 2005 12:21 pm    Post subject: Reply with quote

Hi, I tested jack's and jtran21's scripts. jtran21's isn't working at all, but jack's is.

I like it, just have a problem: I use the setting in Windows 2000 that activates windows by just moving the mouse cursor over them - no need for clicking. When I now move a window and the mouse cursor stays at its place it will focus the next window, which will then be moved Sad

Any fix for that?
Back to top
View user's profile Send private message
brotherS



Joined: 01 Jun 2005
Posts: 147

PostPosted: Wed Sep 14, 2005 8:39 am    Post subject: Reply with quote

Could someone/Jack perhaps add some code to it, so that the mouse cursor just would move the same distance and direction the window itself does? That should fix it! Smile
Back to top
View user's profile Send private message
Hotfoot



Joined: 14 Sep 2005
Posts: 21

PostPosted: Sat Oct 08, 2005 7:57 pm    Post subject: Reply with quote

Just add the MouseMove command to each hotkey -- after the WinMove command:

Code:

; for right
MouseMove, 100,0,,R

; for left
MouseMove, -100,0,,R

; for up
MouseMove, 0, -100, , R

; for down
MouseMove, 0, 100, , R


This Move-Windows code seems useful for moving windows around in a multi-monitor environment. I set mine up so that Windows-arrow keys move small increments and Windows-Control-arrow keys move larger increments.
Back to top
View user's profile Send private message
brotherS



Joined: 01 Jun 2005
Posts: 147

PostPosted: Sun Oct 09, 2005 7:14 am    Post subject: Reply with quote

Thanks for your ideas and comments, the script is working perfectly now, looking like this:

Code:

;2005-09-20 move active window around with Ctrl+Windows+left/right/up/down
;move active window xx pixels right
;replace # (Windows key) with ^# (Ctrl + Windows keys) if you like
#right::
   wingetpos x, y,,, A   ; get coordinates of the active window
   x += 25           ; 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 -= 25
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%, 0
   return

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

; move active window xx pixels down
#Down::
   wingetpos x, y,,, A
   y += 25
   mousegetpos, mx, my
   winmove, A,,%x%, %y%
   mousemove, %mx%, %my%, 0
   return
;2005-09-20 move active window around with Ctrl+Windows+left/right/up/down
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Jun 20, 2007 7:00 pm    Post subject: why write/use this type of macro Reply with quote

I need to compare design time verses run time of an application, alt+space+m+enter does not cut it. This macro, changed very easily to do +1 instead of +100, easily gets my transparent design over the run time and wouldn't you know it Oracle messed with the fonts! And not consistently either.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group