Jump to content

IE Zoom


Recommended Posts

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

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.

:mellow:

Edited 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

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.

:mellow:

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

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.

:mellow:

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

  • 11 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...