topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:42 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Maximize Windows "partially" [finished]  (Read 32768 times)

kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Maximize Windows "partially" [finished]
« on: August 19, 2009, 05:38 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 AM by kli6891 »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #1 on: August 19, 2009, 05:59 PM »
maybe not a perfect fit, but gridmove might be of interest

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #2 on: August 19, 2009, 06:44 PM »
Mouser's own Desktop Coral is probably what you're after.

kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #3 on: August 19, 2009, 07:17 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?  :D

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #4 on: August 19, 2009, 08:16 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. :)



lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #5 on: August 19, 2009, 09:04 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..

firefox.exe Screenshot - 20_08_2009 , 9_59_35 AM.png

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #6 on: August 20, 2009, 01:23 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-so...default.asp?lngWId=1


kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #7 on: August 20, 2009, 05: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.

kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #8 on: August 22, 2009, 09:21 AM »
Ok, the weekend has arrived, and I tried tackling this program.
And immediately I need some help  :'(.


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.

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #9 on: August 22, 2009, 10:44 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?


kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #10 on: August 22, 2009, 11:23 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).


AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #11 on: August 22, 2009, 10:09 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 PM by AndyM »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #12 on: August 23, 2009, 05:17 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. :)

kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #13 on: August 23, 2009, 05:29 PM »
Ok then. A hotkey sounds like a good idea, and it's a lot less work  ;D!

qwibbles

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 22
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #14 on: August 23, 2009, 05:42 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

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #15 on: August 23, 2009, 07:48 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.)

^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 PM by MilesAhead »

Antonimo

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 21
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #16 on: August 24, 2009, 12:51 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:
#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.

nhiko

  • Participant
  • Joined in 2006
  • *
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #17 on: August 24, 2009, 02:26 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...es/fiches/45022.html (I'm french, don't mention it...  :D )

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #18 on: August 24, 2009, 11:03 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.

kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially"
« Reply #19 on: August 24, 2009, 04:48 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?

kli6891

  • Honorary Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 36
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially" [finished]
« Reply #20 on: September 07, 2009, 12:27 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.autohotke...6891/onTop/onTop.ahk

ehatherley

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially" [finished]
« Reply #21 on: November 02, 2011, 10:37 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.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially" [finished]
« Reply #22 on: November 02, 2011, 11:02 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:

Code: Autohotkey [Select]
  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:

Code: Autohotkey [Select]
  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:

Code: Autohotkey [Select]
  1. topX := getValue(DpLeft)
  2. topY := getValue(DpTop)
  3.  
  4. DpRight := getValue(DpRight)
  5. DpBottom := getValue(DpBottom)


Untested, but it should work.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Maximize Windows "partially" [finished]
« Reply #23 on: November 02, 2011, 03:13 PM »
Thanks for sharing ehatherley, and for the follow up, skwire.  :up:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Maximize Windows "partially" [finished]
« Reply #24 on: November 02, 2011, 03:53 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.

taskbar.png

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.

workareashot.jpg
« Last Edit: November 02, 2011, 03:59 PM by MilesAhead »