maniootek Posted February 21, 2017 Posted February 21, 2017 Is there any way to change IE window size according to its content size? #include <IE.au3> $oIE = _IECreate() _IEBodyWriteHTML($oIE, '<table id="mytable"><tr><td style="white-space:nowrap; border: 1px solid black;">This is some text inside table row without space. I want to set internet explorer window size according to size of this table</td><tr></table>') $oTable = _IEGetObjById($oIE, "mytable") $width = _IEPropertyGet($oTable, "width") $height = _IEPropertyGet($oTable, "height") WinMove(_IEPropertyGet($oIE, "hwnd"), "", default, default, $width+150, $height+150) In this example I have added 150 pixel to width and 150 pixel to height to my my table visible but I am looking for perfect solution which set the size of IE window perfectly to its content. Any idea?
genius257 Posted March 7, 2017 Posted March 7, 2017 Hi @maniootek. This is as close as i could get it. Hope it helps you #include <IE.au3> $oIE = _IECreate() _IEBodyWriteHTML($oIE, '<table id="mytable"><tr><td style="white-space:nowrap; border: 1px solid black;">This is some text inside table row without space. I want to set internet explorer window size according to size of this table asdjalskdjsalkjdalksjdlk</td><tr></table>') $iWidthMax = 0 For $oNode In $oIE.document.body.children $iWidthMax = ($oNode.offsetLeft + $oNode.offsetWidth)>$iWidthMax?($oNode.offsetLeft + $oNode.offsetWidth):$iWidthMax Next $oIE.width = $iWidthMax + ($oIE.width-$oIE.document.body.offsetWidth) To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now