Page 1 of 1

How to expand window vertically ONLY

Posted: 21 Jun 2021, 01:48
by milkygirl90
As per this example on Potplayer, it does not respond to a Win+Right shortcut. After expanding to a certain window size, I want the window to expand and fill the bottom vertically.

Note that I cannot use Shift+Win+Down because it changes the window size to 50%, not 65% as I indicated.

How can I achieve that on AutoHotkey?
image.png
image.png (17.76 KiB) Viewed 610 times

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 02:44
by Smile_
Here is a way:

Code: Select all

F1::
   WinGetPos, X, Y,,, ahk_exe PotPlayerMini64.exe
   Height := A_ScreenHeight - Y - 40
   WinMove, ahk_exe PotPlayerMini64.exe,, X, Y,, Height
Return

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 04:06
by milkygirl90
unfortunately it did not do anything to expand the window downwards..

I noticed it only responds if I pause for a few seconds before hitting the hotkey another time. Modifying the script to match this behavior didn't work:

Code: Select all

q::
;SendInput !4
  WinGetPos, X, Y,,, ahk_exe PotPlayerMini64.exe
   Height := A_ScreenHeight - Y - 40
  
      WinMove, ahk_exe PotPlayerMini64.exe,, X, Y,, Height
	   Sleep 500      
	   WinMove, ahk_exe PotPlayerMini64.exe,, X, Y,, Height
return

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 05:11
by Smile_
Just in one case this is not applied for me is when the windows is resized manually, because I think Potplayer keep that size until the blue text disappear.
Screenshot.png
Screenshot.png (515.83 KiB) Viewed 574 times

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 05:17
by milkygirl90
Smile_ wrote:
21 Jun 2021, 05:11
Just in one case this is not applied for me is when the windows is resized manually, because I think Potplayer keep that size until the blue text disappear.

Screenshot.png
mine does not get resized regardless of whether the blue text appears...

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 05:37
by Smile_
Are you sure about the ahk_exe name?
I use 64 bits of Potplayer, it might be not the case for you, use WindowSpy to get ahk_exe name
Screenshot.png
Screenshot.png (423 KiB) Viewed 560 times

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 06:04
by milkygirl90
Smile_ wrote:
21 Jun 2021, 05:37
Are you sure about the ahk_exe name?
I use 64 bits of Potplayer, it might be not the case for you, use WindowSpy to get ahk_exe name
Screenshot.png
yup the exe is correct.

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 06:21
by Smile_
Well, can you check X, Y, and Height values within a message box before executing WinMove command?, they may be incorrect.

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 19:57
by milkygirl90
the coordinates are correct but it doesn't always move the window. When it does, it changes the horizontal position too.

Is there another way to do this? How do I get ahk to drag the bottom part of the window to the bottom of screen instead?

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 20:16
by boiler
Use WinGetPos to figure out where the bottom border of the window is, then use MouseClickDrag to drag it to the bottom of the screen. You might want to use SysGet, ..., MonitorWorkArea to determine the bottom of the screen not including the taskbar. You may be able to just get away with dragging it to a y coordinate that is known to be past the bottom of the screen, and Windows will have it stop at the bottom of the usable screen.

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 21:00
by milkygirl90
boiler wrote:
21 Jun 2021, 20:16
Use WinGetPos to figure out where the bottom border of the window is, then use MouseClickDrag to drag it to the bottom of the screen. You might want to use SysGet, ..., MonitorWorkArea to determine the bottom of the screen not including the taskbar. You may be able to just get away with dragging it to a y coordinate that is known to be past the bottom of the screen, and Windows will have it stop at the bottom of the usable screen.
is this correct? My taskbar is on the right, so shouldn't be an issue. I tried many times but it only resizes to a quarter of my screen:

Code: Select all

Numpad2::
SendInput !4
 WinGetPos, X, Y,,, ahk_exe PotPlayerMini64.exe
  WinActivate, ahk_exe PotPlayerMini64.exe
MouseClickDrag, L, X, Y, (A_ScreenWidth*2), (A_ScreenHeight*2)
	 return

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 21:12
by milkygirl90
To put it another way, my objective is to resize Evernote to take up 20% of screen size and Potplayer to take up the remaining 80% side by side. Not sure if that makes it easier.

Re: How to expand window vertically ONLY

Posted: 21 Jun 2021, 22:16
by boiler
I don’t understand how the coordinates you selected and the math you showed are supposed to provide the desired result. For one thing, it seems like you would need to specify CoordMode, Mouse, Screen. Then it seems you are attempting to drag the upper-left corner of the window (x,y) to a point way off the screen. Perhaps you can describe the goal of that, and not just be restating, “my objective is to resize Evernote to take up 20% of screen size and Potplayer to take up the remaining 80% side by side.” Are you trying to drag the upper-left corner of the window off the screen, and if so, why?