Welcome Guest.   Make a donation to an author on the site December 22, 2014, 06:55:12 PM  *

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.
 
The N.A.N.Y. Challenge 2010! Download 24 custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Maximize Windows "partially" [finished]  (Read 14439 times)
kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« on: August 19, 2009, 05:38:16 PM »

Is it possible to make a program using AHK such that when I maximizes a window, it doesn't fill the entire screen, rather it fills it partially.

The gadgets sidebar in Windows Vista is like this; when you maximize, the window maximizes up to the sidebar, and doesn't cover it. Something like that, but a user defined region, is what I'm looking for.


Thanks.
« Last Edit: September 07, 2009, 12:21:12 AM by kli6891 » Logged

Target
Honorary Member
**
Posts: 1,423



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: August 19, 2009, 05:59:00 PM »

maybe not a perfect fit, but gridmove might be of interest
Logged

"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
skwire
Global Moderator
*****
Posts: 4,186



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: August 19, 2009, 06:44:18 PM »

Mouser's own Desktop Coral is probably what you're after.
Logged

kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: August 19, 2009, 07:17:37 PM »

Thanks for the responses.

I tried desktop coral, and it's close to what I want. However, it seems that I can't put windows in the reserved area, which is what I'm after.

More help?  cheesy
Logged

MilesAhead
Member
**
Posts: 5,159



View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: August 19, 2009, 08:16:10 PM »

You could do it a number of ways.  Anything that has a "Win Move" type function can move and resize the window.  It's more a matter if the normal mouse click in the maximize control has to be detected that would take some time. If you can use a hotkey or special mouse click or even a command line such as NirCmd then it would be easier.

edit: otoh I'd be very surpised if Softpedia.com or ZDNet didn't have something already debugged. smiley


Logged

"I worked myself up from nothing to a state of extreme poverty."
- Groucho Marx
lanux128
Global Moderator
*****
Posts: 6,136



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: August 19, 2009, 09:04:51 PM »

The gadgets sidebar in Windows Vista is like this; when you maximize, the window maximizes up to the sidebar, and doesn't cover it. Something like that, but a user defined region, is what I'm looking for.

as Target posted, GridMove has support for user-defined regions. another alternative is Hawkeye ShellInit.

maybe you want to try MaxTo as well but it's not free..

Logged

MilesAhead
Member
**
Posts: 5,159



View Profile WWW Give some DonationCredits to this forum member
« Reply #6 on: August 20, 2009, 01:23:05 PM »

The main thing I would see with the "do it yourself" approach is you'd need to use something, maybe an .ini file, to enter params for either maximization or the area to leave open when maximized, and the previous size of the window so you could toggle it back.  Say if you did a middle mouse click on the title bar, get active window, if it's not at the custom max size, store current size and position and max it(maybe just store the window info to the .ini file or some data file of your own design or something.) If you middle click something already maxed and previous position/size info is there, restore to those settings, if no info, restore to 1/2 screen size or some default, etc..

You could do that fairly easily with AHK, AutoIt3 or VBS script.  In fact you might find something on this site for VBS:

http://www.planet-source-...m/vb/default.asp?lngWId=1

Logged

"I worked myself up from nothing to a state of extreme poverty."
- Groucho Marx
kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: August 20, 2009, 05:18:18 PM »

Thanks for the suggestions again. I'll tried to do this with AHK, since it sounds like a fun and useful (to me at least) project to tackle.

I'll report here if/when I'm finished.
Thanks again.
Logged

kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: August 22, 2009, 09:21:44 AM »

Ok, the weekend has arrived, and I tried tackling this program.
And immediately I need some help  Cry.


How do I make AHK detect that a user has initiated a maximize action. I read the documentation on OnMessage(), but it seems that it can only receive messages send to the AHK script, not to other windows. Perhaps someone w/ experience can help me with this?


My other idea is to do a continuous loop with WinGet to see if the window is maximized. And if it goes from normal to maximized, then the script will trigger.


Does anyone have a better idea?


Thanks.
Logged

AndyM
Charter Member
***
Posts: 616


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #9 on: August 22, 2009, 10:44:17 AM »

How do I make AHK detect that a user has initiated a maximize action.

Are you looking to intercept a mouse-click on the maximize button or the keystrokes for the menu selection?

Logged
kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #10 on: August 22, 2009, 11:23:41 AM »

^^ Both if possible. (Of course, Windows 7 introduces 2 more ways of maximizing a window, either by dragging it to the top of the screen, or Win+Up combination).

Logged

AndyM
Charter Member
***
Posts: 616


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #11 on: August 22, 2009, 10:09:44 PM »

I use two Macro programs, Autohotkey and Macro Express, each has it's strengths.  This would be a snap using Macro Express, but I'm sure it could be done easily enough in AutoHotkey, particularly if you hardcode the window size for your monitor and personal preferences.  Just use the appropriate window resize command.  

More complicated if you want it to work using any size monitor, then you have to get the monitor size and have the code do the math.

Should be easy to have the macro fire with a left-click on the Maximize button, maybe not so easy to trap "Alt-Space,X", but for my own use I'd assign a different hotkey anyway.  I know you wanted to trigger the resizing by catching the actual maximization, but someone else will have to tell you how to do that.
« Last Edit: August 22, 2009, 10:15:43 PM by AndyM » Logged
MilesAhead
Member
**
Posts: 5,159



View Profile WWW Give some DonationCredits to this forum member
« Reply #12 on: August 23, 2009, 05:17:01 PM »

I agree with AndyM.  If you use your own hotkey, then the "real" windows maximize will still work.  If your interception code does crazy things, then you'd have to kill your program to keep your desktop from acting like it was malware infected. smiley
Logged

"I worked myself up from nothing to a state of extreme poverty."
- Groucho Marx
kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: August 23, 2009, 05:29:48 PM »

Ok then. A hotkey sounds like a good idea, and it's a lot less work  Grin!
Logged

qwibbles
Supporting Member
**
Posts: 22


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #14 on: August 23, 2009, 05:42:34 PM »

Do you really want to maximise or just restore a screen layout? Actual Window Manager can do this and there is a 50% discount at the moment on the DC specials page ... Just a thought ...

WindowPad AHK Script or gridemove as previously listed could also be useful?

Or Winsplit Revolution can be setup like gridemove with a custom grid ..

Not sure any exactly match what you are asking for ... but the AHK script might be useful.

Qwibbles
Logged
MilesAhead
Member
**
Posts: 5,159



View Profile WWW Give some DonationCredits to this forum member
« Reply #15 on: August 23, 2009, 07:48:47 PM »

Basically to "maximize" to a certain size that will leave a portion of the desktop uncovered by the maximized app the hotkey just has to call a WinMove function on the active window(should be active since you just clicked on it or you might have to left click to make sure it's active, then click.  My ToggleTopmost takes that approach.  You Control-Right click on the active window and it toggles the "topmost" window attribute... so it's very easy to do.)

Once it's working then you might add a means of changing the window position and size via either .ini file or by the Tray Icon.  Either way is fairly straight-forward.

Here's a snippet where I get the active window, toggle the Topmost attribute, then I get the attribute and test for Topmost.  Then MsgBox tells the user the current state.. otherwise there'd be no feedback if the toggle succeeded(other than dragging another window in front or whatever.)

[copy or print]
^RButton::
WinGetTitle,title,A
WinSet,Topmost,TOGGLE,A
WinGet, ExStyle,ExStyle,%title%
if (ExStyle & 0x8)
  MsgBox,4096,Topmost Toggle, Topmost for window  %title% Enabled,2
else
  MsgBox,4096,Topmost Toggle, Topmost for window  %title% Disabled,2
return

In this case WinMove should be the primary function instead.
« Last Edit: August 23, 2009, 07:50:29 PM by MilesAhead » Logged

"I worked myself up from nothing to a state of extreme poverty."
- Groucho Marx
Antonimo
Participant
*
Posts: 21

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #16 on: August 24, 2009, 12:51:07 AM »

I use Autohotkey for resizing windows all the time. I have several different hotkeys that will resize to different sizes and positions depending on the window I am moving / resizing.

For example:
[copy or print]
#1::
WinMove A, , 300, 50, 1024, 1001,
Return
will move the active window 300 pixels in from the left and 50 pixels down from the top. It will resize the window to 1024 pixels wide and 1001 pixels high.

The hotkey combination is Windows + 1

I use this particular hotkey to resize my browser.

If the window is already maximised when this hotkey is used, it remains maximised in the new position and size so that clicking on the maximise / restore button in the top right will restore the window to the previous non-maximised size.
Logged
nhiko
Participant
*
Posts: 1


View Profile Give some DonationCredits to this forum member
« Reply #17 on: August 24, 2009, 02:26:28 AM »

You should try Winsplit revolution, not a real maximize but you can define regions and hotkeys. Main site seem down, here is a link  http://www.01net.com/tele...itaires/fiches/45022.html (I'm french, don't mention it...  cheesy )
Logged
AndyM
Charter Member
***
Posts: 616


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #18 on: August 24, 2009, 11:03:05 AM »

Keep in mind that you could adapt Antonimo's code to work for various windows to be resized/moved depending on which window has focus, all fired with the same hotkey.  See IfWinActive, etc.
Logged
kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #19 on: August 24, 2009, 04:48:21 PM »

Hmm, I think what I'm going to try to make is to make an "add-on" script for Desktop Coral. It should read the .ini values, and when the user presses a hot key, it will move the the active window (and resizing it) to fit the area that's covered. This is less work for me, and it makes good use of an already existing program.


Thoughts?
Logged

kli6891
Honorary Member
**
Posts: 36

View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #20 on: September 07, 2009, 12:27:13 AM »

OK, I finished my program. It works in conjunction with Desktop Coral (by mouser), so that when the user presses a hotkey (configurable), it moves the active window to the dock of Desktop Coral.

You need the latest version of Desktop Coral (1.07.01 - September 6, 2009) for this to work. You can download it here.


Once you downloaded and docked Desktop Coral, you can use my script, and press ctrl+shift+e to make the current window move (and resized) to the docked place.

In the .ini file, you can change the hotkey, as well as the path of your DesktopCoral.ini file.

Thanks to mouser and everyone who helped in this thread.
Bug reports and suggestions are welcome!


Download the script here.
http://www.autohotkey.net/~kli6891/onTop/onTop.ahk
Logged

ehatherley
Participant
*
Posts: 1

View Profile Give some DonationCredits to this forum member
« Reply #21 on: November 02, 2011, 10:37:23 AM »

script does not work with Desktop Coral v1.10.01 due to a change in the .INI file or possibly a change in the way AHK counts lines. In any case, the script can be 'fixed' by changing the following lines:

   FileReadLine, DpLeft, %DC_Ini_Path%, 25
   FileReadLine, DpTop, %DC_Ini_Path%, 26
   FileReadLine, DpRight, %DC_Ini_Path%, 27
   FileReadLine, DpBottom, %DC_Ini_Path%, 28

change to read:

   FileReadLine, DpLeft, %DC_Ini_Path%, 26
   FileReadLine, DpTop, %DC_Ini_Path%, 27
   FileReadLine, DpRight, %DC_Ini_Path%, 28
   FileReadLine, DpBottom, %DC_Ini_Path%, 29

Ideally, the script should be expanded to scan the .INI file to find the proper section and read the assignments rather than blindly copying values, but this will do for a quick&dirty workaround.
Logged
skwire
Global Moderator
*****
Posts: 4,186



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #22 on: November 02, 2011, 11:02:23 AM »

Ideally, the script should be expanded to scan the .INI file to find the proper section and read the assignments rather than blindly copying values, but this will do for a quick&dirty workaround.

Change the following lines from:

Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. FileReadLine, DpLeft, %DC_Ini_Path%, 25
  2. FileReadLine, DpTop, %DC_Ini_Path%, 26
  3. FileReadLine, DpRight, %DC_Ini_Path%, 27
  4. FileReadLine, DpBottom, %DC_Ini_Path%, 28

To:

Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. IniRead, DpLeft, %DC_Ini_Path%, DockedPanel, DpLeft
  2. IniRead, DpTop, %DC_Ini_Path%, DockedPanel, DpTop
  3. IniRead, DpRight, %DC_Ini_Path%, DockedPanel, DpRight
  4. IniRead, DpBottom, %DC_Ini_Path%, DockedPanel, DpBottom

You will probably need to remove the following lines as well:

Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. topX := getValue(DpLeft)
  2. topY := getValue(DpTop)
  3.  
  4. DpRight := getValue(DpRight)
  5. DpBottom := getValue(DpBottom)


Untested, but it should work.
Logged

mouser
First Author
Administrator
*****
Posts: 33,795



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #23 on: November 02, 2011, 03:13:09 PM »

Thanks for sharing ehatherley, and for the follow up, skwire.  thumbs up
Logged
MilesAhead
Member
**
Posts: 5,159



View Profile WWW Give some DonationCredits to this forum member
« Reply #24 on: November 02, 2011, 03:53:51 PM »

Is it possible to make a program using AHK such that when I maximizes a window, it doesn't fill the entire screen, rather it fills it partially.

The gadgets sidebar in Windows Vista is like this; when you maximize, the window maximizes up to the sidebar, and doesn't cover it. Something like that, but a user defined region, is what I'm looking for.


Thanks.

Since this topic was created I have found a simple approach that works in some circumstances.  It simply sets the Work Area of the desktop using the Windows Set Work Area function.

Note that if Taskbar AutoHide is enabled, the system ignores the work area setting.

You can download Adjust Work Area from this page:

http://www.favessoft.com/downloads.html

As you can see in this screen shot, I use RocketDock. That got me interested in ways to maximize a window without obscuring it.



I have a .cmd file in my StartUp Folder that uses awa.exe to set the work area to leave RocketDock in the clear.  This screen shot shows an editor maximized in the normal way. Notice that RocketDock is not covered.

« Last Edit: November 02, 2011, 03:59:57 PM by MilesAhead » Logged

"I worked myself up from nothing to a state of extreme poverty."
- Groucho Marx
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.09s | Server load: 0.14 ]