Jump to content

Zoom IE


Sbarabau
 Share

Recommended Posts

Something to get you started. That just reads the current setting.

You can root around in the DOM methods on MSDN (I never did find it) or just use ControlSend():

WinActivate("[CLASS:IEFrame; TITLE:Google]", "")

ControlSend("[CLASS:IEFrame; TITLE:Google]", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "^{+}")
Sleep(500)
ControlSend("[CLASS:IEFrame; TITLE:Google]", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "^{+}")
Sleep(2000)

ControlSend("[CLASS:IEFrame; TITLE:Google]", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "^{-}")
Sleep(500)
ControlSend("[CLASS:IEFrame; TITLE:Google]", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "^{-}")

;)

Edit: Clarity.

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

There is no zoom in an IE ActiveX control (embedded) instance, even when done manually. So as far as I know you're out of luck.

Exactly as with the full IE instance, XDPI and YDPI are there for read-only reference, though:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState()       ;Show GUI

_IENavigate ($oIE, "http://www.autoitscript.com")
$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)

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            _IENavigate ($oIE, "http://www.autoitscript.com")
        Case $msg = $GUI_Button_Back
            _IEAction ($oIE, "back")
        Case $msg = $GUI_Button_Forward
            _IEAction ($oIE, "forward")
        Case $msg = $GUI_Button_Stop
            _IEAction ($oIE, "stop")
    EndSelect
WEnd

GUIDelete()

Exit

;)

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

But there's no way to send a check to the page embedded with the command:

ControlSend("[CLASS:IEFrame; TITLE:Google]", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "^{+}")

?

You lost me. We were talking about zoom level, and now "...there's no way to send a check to the page embedded...".

What do you mean by "send a check"? The function you posted would be for a regular instance of IE, and would change the zoom level.

For an embedded instance, you would have to change the window ID to that of the parent window containing the embedded IE control, and the zoom level wouldn't change anyway because that functionality is not there in an embedded browser instance, as far as I can tell.

;)

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

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...