Solved

Need Window keys to center active window

Posted on 2012-03-21
10
299 Views
Last Modified: 2012-03-23
Hi, I'm wondering if there is a key combination to center the active window for Win 7?
Thanks
0
Comment
Question by:camtz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 10

Expert Comment

by:Tobias
ID: 37746573
There's no combination by default in Win 7 for this, but you could use Windows Key + Up arrow to maximize the window.
0
 
LVL 3

Expert Comment

by:Charlie2012
ID: 37746583
Win+Arrow Right/Win+Arrow Left (move active window left/centre/right)

http://www.shortcutworld.com/en/win/Windows_7.html
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 37746864
I think you need a tool like AutoHotkey. I just installed it and found some code to assign this 'center window' functionality to a key:

^!z::
X = %A_ScreenWidth% 
Y = %A_ScreenHeight% 
WinGetPos, , , WindW, WindH, A ;get active window size 
X-=%WindW% 
Y-=%WindH% 
X/=2 
Y/=2 
;MsgBox, X: %X%`nY: %Y% ; For testing 
WinMove, A, , %X%, %Y% ;move active window to center of screen 
Return

Open in new window


So this "^!z" uses the key combination Ctrl-Alt-z but you can change that of course. Just noticed that it moves the window to the first monitor, but I think I've seen some customizations that allow for multi-monitor usage, should you need that.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:camtz
ID: 37749000
Man, what a pro you are.  I too just started using AutoHotkeys and love it.  I copy/paste your work in my file and tested it and it worked perfect.  I wish there was a way of requesting you for future issues with this program.  Is there?  -  I'm no programer but I'll be glad to paste my scripts in here if you would like just in case you want to use some.  But, it doesn't seem like you need any help from me.

One other thing if you don't mind, I know the symbols used by AutoHotkey for
Ctrl   =  ^
Alt    =  !
Win  =  #
But that's all I know.  Where can I get the rest of them such as for 1) space bar, 2) Shift, 3) Tab, 4) Enter and any others that might be required.

Thank you so very much for this.  I've looked at many sites on the web and none of them have anything about centering the window on the desktop.
0
 

Author Comment

by:camtz
ID: 37749065
One last thing I'm trying to do is to set up some keys to display my Land Line Connection dialog window so that I can enable/disable it.  Can that be done with AutoHotkeys?
Thanks
Carlos
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 37749155
Ho wait, it's not my code, I found it on the net. I just extracted it because it seemed you wouldn't want too many other stuff.

The symbols should be in the documentation, in your start menu or on their website, yep there it is: http://www.autohotkey.com/docs/Hotkeys.htm#Symbols 

On opening a connection dialog: If you know which process it starts (maybe you can find out via Task Manager, but not always) then you should be able to start it with the Run command in your .ahk file.
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 37749383
I'll let you in on my 'secret': This is the first thing I found that I thought could be useful: http://www.autohotkey.com/forum/topic21703.html 

Then I did some more searches and found this discussion: http://www.autohotkey.com/forum/topic12497.html which actually builds on code they found somewhere else themselves.

That code (at the end of the page) seemed excellent so I played around with it a bit, changed the hotkey because "<" seemed strange to me, and then posted it for you. I did have a problem where certain windows (eg Computer Management) don't want to move, haven't figured out why yet.

So let me stress that I'm certainly not some kind of AutoHotkey virtuoso, just combined some stuff I found into what seemed to me a solution that would fit your need ;-)

I actually didn't answer your other question before: No I'm afraid you can't 'assign an expert' to a question, but if you post a question that's not being answered you could email me a link to it (see my profile) and if appropriate I'll see what I can do.
0
 
LVL 10

Expert Comment

by:Tobias
ID: 37749494
I don't want be negative but calm down it's only 12 lines of code, and if you asked to do it, I would use autoit not autohotkey...
0
 

Author Comment

by:camtz
ID: 37750114
I don't care how you got it.  The point is that you got it.  I took note of the sites you gave me and I will look at them as soon as I have time.  Regarding the Lan Line Connection, I made a shortcut for it and assigned it some hot keys but as you know, Windows always want's to use three keys and I prefer two.

I assigned Ctrl comma (,) but windows added Alt so If I hit Ctrl/Alt/, - the program runs and I get the Lan Line Connection window on my desktop.  I wanted to change it so that I would only have to use Ctrl and (,) so I wrote this script for the program but it doesn't work.;

^,::
Run ^!,
Return

So where am I going wrong?
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 37750611
I think you would need to put the same reference to an exe (or other program type) after Run that you put in the shortcut instead of trying to run the existing hot key combination (although I haven't looked at that part of the documentation in great detail yet).
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to set permissions to allow a limited-permissions user to start and stop a particular System Service.   It is always best to give users only the permissions that they need to perform their job, so tweaking particular permi…
Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question