Help please! Can't get WinMove to resize an Internet Explorer? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
blakeyj08
Posts: 2
Joined: 28 Aug 2017, 20:11

Help please! Can't get WinMove to resize an Internet Explorer?

28 Aug 2017, 20:30

Hi all, I'm new to AHK scripting, but have experience in other languages. I'm working on a script for an executive user that will open a whole bunch of IE windows, navigate to various sites, and then arrange them across his 3 monitors. Thus far I've got the windows opening, navigating to the correct pages, and being placed at the correct x and y coordinates, but for some reason the windows aren't being resized.

For example, one monitor should have 4 windows arranged in a grid. The monitor working area is 1920x1200, so 960x600 for each window. However, when I run the below, they are all coming out at about 540x800. Can someone help me out and validate that I'm using WinMove correctly? I've put in some MsgBox commands for troubleshooting, and they are all showing the values that I expect, but I can't figure out why the resize isn't happening correctly. TIA!

Code: Select all

	SysGet, m1, MonitorWorkArea, 1
	WinTop:=m1Top
	WinLeft:=m1Left
	WinHeight:=floor(Abs((m1Bottom-m1Top)/m1Rows))
	WinWidth:=floor(Abs((m1Right-m1Left)/m1Cols))

	run, "C:\Program Files\Internet Explorer\iexplore.exe" %A_LoopField%
	sleep, 500

	MsgBox, 4144, Testing, Height:%WinHeight% Width:%WinWidth% LeftPos:%WinLeft% TopPos:%WinTop%
	WinMove, ahk_class IEFrame,, WinLeft, WinTop, %WinHeight%, %WinWidth% ;I've also tried WinHeight and WinWidth (without % %, but same result)
BoBo
Posts: 3764
Joined: 13 May 2014, 17:15

Re: Help please! Can't get WinMove to resize an Internet Explorer?

29 Aug 2017, 00:44

For testing I'd prefer a ToolTip over a MsgBox as timing seems relevant in this case.
First I'd play around with that Sleep setting to ensure that the problem isn't the result of a variing system performance.
Second, I'd have a try with Runs OutputVarPID parameter to use WinMove :arrow: "ahk_pid" separately for each window. Good luck.
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: Help please! Can't get WinMove to resize an Internet Explorer?  Topic is solved

29 Aug 2017, 02:09

This is because you are using MonitorWorkArea which returns the dimensions minus the taskbar you should use Monitor you also mixed up height and width and should use %

Code: Select all

SysGet, m1, Monitor, 1
...
WinMove, ahk_class IEFrame,, %WinLeft%, %WinTop%, %WinWidth%, %WinHeight%
blakeyj08
Posts: 2
Joined: 28 Aug 2017, 20:11

Re: Help please! Can't get WinMove to resize an Internet Explorer?

29 Aug 2017, 11:05

obeeb wrote:This is because you are using MonitorWorkArea which returns the dimensions minus the taskbar you should use Monitor you also mixed up height and width and should use %

Code: Select all

SysGet, m1, Monitor, 1
...
WinMove, ahk_class IEFrame,, %WinLeft%, %WinTop%, %WinWidth%, %WinHeight%
Of course it was something stupid. After hours of looking at it, I had height and width backwards :x

Return to “Ask For Help”

Who is online

Users browsing this forum: blue83, keylo, mikeyww, RubbeH, songdg, william_ahk and 47 guests