How to expand window vertically ONLY

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

How to expand window vertically ONLY

21 Jun 2021, 01:48

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 584 times
User avatar
Smile_
Posts: 857
Joined: 03 May 2020, 00:51

Re: How to expand window vertically ONLY

21 Jun 2021, 02:44

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
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: How to expand window vertically ONLY

21 Jun 2021, 04:06

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
User avatar
Smile_
Posts: 857
Joined: 03 May 2020, 00:51

Re: How to expand window vertically ONLY

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
Screenshot.png (515.83 KiB) Viewed 548 times
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: How to expand window vertically ONLY

21 Jun 2021, 05:17

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...
User avatar
Smile_
Posts: 857
Joined: 03 May 2020, 00:51

Re: How to expand window vertically ONLY

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
Screenshot.png (423 KiB) Viewed 534 times
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: How to expand window vertically ONLY

21 Jun 2021, 06:04

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.
User avatar
Smile_
Posts: 857
Joined: 03 May 2020, 00:51

Re: How to expand window vertically ONLY

21 Jun 2021, 06:21

Well, can you check X, Y, and Height values within a message box before executing WinMove command?, they may be incorrect.
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: How to expand window vertically ONLY

21 Jun 2021, 19:57

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?
User avatar
boiler
Posts: 16773
Joined: 21 Dec 2014, 02:44

Re: How to expand window vertically ONLY

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.
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: How to expand window vertically ONLY

21 Jun 2021, 21:00

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
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: How to expand window vertically ONLY

21 Jun 2021, 21:12

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.
User avatar
boiler
Posts: 16773
Joined: 21 Dec 2014, 02:44

Re: How to expand window vertically ONLY

21 Jun 2021, 22:16

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?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Billykid and 212 guests