Affe Posted May 25, 2010 Share Posted May 25, 2010 Looking to see if there is a function or way to get and set the zoom property for IE. I can change it manually by sending CTRL+ or CTRL-, but I don't know of a way to read the current zoom level (and am hoping for a simple way to set the zoom level). Thanks in advance [center][/center] Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 25, 2010 Share Posted May 25, 2010 (edited) This only tested with IE8: #include <IE.au3> $sURL = "http://www.autoitscript.com" $oIE = _IECreate($sURL, 1) $oScreen = $oIE.document.parentwindow.screen $iXDPI = $oScreen.deviceXDPI $iYDPI = $oScreen.deviceYDPI $iLogicalXDPI = $oScreen.logicalXDPI $iLogicalYDPI = $oScreen.logicalYDPI $iXZoom = $iXDPI / $iLogicalXDPI * 100 $iYZoom = $iYDPI / $iLogicalYDPI * 100 ConsoleWrite("$iXDPI = " & $iXDPI & "; $iYDPI = " & $iYDPI & @LF) ConsoleWrite("$iLogicalXDPI = " & $iLogicalXDPI & "; $iLogicalYDPI = " & $iLogicalYDPI & @LF) ConsoleWrite("Horizontal Zoom = %" & $iXZoom & "; Vertical Zoom = %" & $iYZoom & @LF) The typical normal (%100) zoom = 96DPI, but that is checked against the "logicalDPI" property. Edited May 25, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Affe Posted May 25, 2010 Author Share Posted May 25, 2010 This only tested with IE8: #include <IE.au3> $sURL = "http://www.autoitscript.com" $oIE = _IECreate($sURL, 1) $oScreen = $oIE.document.parentwindow.screen $iXDPI = $oScreen.deviceXDPI $iYDPI = $oScreen.deviceYDPI $iLogicalXDPI = $oScreen.logicalXDPI $iLogicalYDPI = $oScreen.logicalYDPI $iXZoom = $iXDPI / $iLogicalXDPI * 100 $iYZoom = $iYDPI / $iLogicalYDPI * 100 ConsoleWrite("$iXDPI = " & $iXDPI & "; $iYDPI = " & $iYDPI & @LF) ConsoleWrite("$iLogicalXDPI = " & $iLogicalXDPI & "; $iLogicalYDPI = " & $iLogicalYDPI & @LF) ConsoleWrite("Horizontal Zoom = %" & $iXZoom & "; Vertical Zoom = %" & $iYZoom & @LF) The typical normal (%100) zoom = 96DPI, but that is checked against the "logicalDPI" property. Awesome, thanks! Is there a way to set it, aside from CTRL+ and CTRL-? I only ask because a custom level would be more ideal than the standard 25% changes. If not, no biggie, and thanks again! [center][/center] Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 25, 2010 Share Posted May 25, 2010 Awesome, thanks! Is there a way to set it, aside from CTRL+ and CTRL-? I only ask because a custom level would be more ideal than the standard 25% changes.If not, no biggie, and thanks again!According to MSDN, the .deviceXDPI property is read only. Don't have time to look into setting it. You might find a .zoom() method attached to .screen or .ParentWindow objects. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
sudeepjd Posted July 23, 2021 Share Posted July 23, 2021 If anyone is still looking for this solution you can use the following to set the IE Zoom level $iZoomLevel = Int(30) ;30% Zoom $oIE.ExecWB (63, 0, $iZoomLevel, Null) 63 is OLECMDID_OPTICAL_ZOOM Link to comment Share on other sites More sharing options...
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