Jump to content

Browser for AutoIt v3.3.7.23 ++


ValeryVal
 Share

Recommended Posts

This example uses new function ObjCreateInterface from AutoIt v.3.3.7.23 (beta) and Mozilla Browser ActiveX. The last control is available from http://www.wxperl.co.uk/MozillaControl1712.exe .

You can also get it from the control's author at http://www.iol.ie/~locka/mozilla/control.htm

The control may not be currently maintained, the last release being in 2005. You should probably therefore not use it as a general browser.

After installation you should register it by regsvr32 utility.

; *******************************************************
; Mozilla ActiveX control example
; AutoIt v3.3.7.23 (beta) ++
; *******************************************************
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global Const $sCLSID_MozillaBrowser = "{1339B54C-3453-11D2-93B9-000000000000}"
Global Const $sIID_IWebBrowserApp   = "{EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B}"
Global $Home = "http://www.yahoo.com/"
$oMZ = ObjCreateInterface($sCLSID_MozillaBrowser,$sIID_IWebBrowserApp)
GUICreate("Mozilla ActiveX Application", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 100, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_Home = GUICtrlCreateButton("Home", 200, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 300, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$URL_Label = GUICtrlCreateLabel("URL:", 10, 50, 40, 20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_URL = GUICtrlCreateInput($Home, 50, 50, 480, 20)
GUICtrlSetResizing(-1,$GUI_DOCKTOP+$GUI_DOCKLEFT+$GUI_DOCKHEIGHT)
$GUI_Button_Go = GUICtrlCreateButton("->", 530, 50, 40, 20)
GUICtrlSetResizing(-1,$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$GUIActiveX = GUICtrlCreateObj($oMZ, 10, 80, 620, 450)
GUICtrlSetResizing($GUIActiveX,$GUI_DOCKTOP+$GUI_DOCKLEFT)
$Status_Label = GUICtrlCreateLabel("Status_Label", 10, 550, 620, 20)
$oSink = ObjEvent($oMZ,"MZEvent_")
GUISetState()      ;Show GUI
$oMZ.Visible = True
$oMZ.Navigate2($Home)
; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
  $oMZ.Quit()
  ExitLoop
Case $msg = $GUI_Button_Go
  $oMZ.Navigate2(GuiCtrlRead($GUI_URL))
Case $msg = $GUI_Button_Home
  $oMZ.GoHome()
Case $msg = $GUI_Button_Back
  $oMZ.GoBack()
Case $msg = $GUI_Button_Forward
  $oMZ.GoForward()
Case $msg = $GUI_Button_Stop
  $oMZ.Stop()
EndSelect
WEnd
Exit
Func MZEvent_StatusTextChange($Text)
  GUICtrlSetData($Status_Label, $Text)
EndFunc
Func MZEvent_NavigateComplete($URL)
  GUICtrlSetData($GUI_URL, $URL)
EndFunc

Enjoy

The point of world view

Link to comment
Share on other sites

es incredible!

thankee

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

This script can save document downloaded as you want:

; *******************************************************
; Mozilla ActiveX control example
; AutoIt v3.3.7.23 (beta) ++
; *******************************************************
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global Const $sCLSID_MozillaBrowser = "{1339B54C-3453-11D2-93B9-000000000000}"
Global Const $sIID_IWebBrowserApp   = "{EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B}"
Global $Home = "http://www.yahoo.com/"
$oMZ = ObjCreateInterface($sCLSID_MozillaBrowser,$sIID_IWebBrowserApp)
GUICreate("Mozilla ActiveX Application", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 100, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_Home = GUICtrlCreateButton("Home", 200, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 300, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_Button_SaveAs = GUICtrlCreateButton("SaveAs", 400, 10, 90, 30)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$URL_Label = GUICtrlCreateLabel("URL:", 10, 50, 40, 20)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$GUI_URL = GUICtrlCreateInput($Home, 50, 50, 480, 20)
GUICtrlSetResizing(-1,$GUI_DOCKTOP+$GUI_DOCKLEFT+$GUI_DOCKHEIGHT)
$GUI_Button_Go = GUICtrlCreateButton("->", 530, 50, 40, 20)
GUICtrlSetResizing(-1,$GUI_DOCKTOP+$GUI_DOCKHEIGHT)
$GUIActiveX = GUICtrlCreateObj($oMZ, 10, 80, 620, 450)
GUICtrlSetResizing($GUIActiveX,$GUI_DOCKTOP+$GUI_DOCKLEFT)
$Status_Label = GUICtrlCreateLabel("Status_Label", 10, 550, 620, 20)
$oSink = ObjEvent($oMZ,"MZEvent_")
GUISetState()      ;Show GUI
$oMZ.Visible = True
$oMZ.Navigate2($Home)
; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
  $oMZ.Quit()
  ExitLoop
Case $msg = $GUI_Button_Go
  $oMZ.Navigate2(GuiCtrlRead($GUI_URL))
Case $msg = $GUI_Button_Home
  $oMZ.GoHome()
Case $msg = $GUI_Button_Back
  $oMZ.GoBack()
Case $msg = $GUI_Button_Forward
  $oMZ.GoForward()
Case $msg = $GUI_Button_Stop
  $oMZ.Stop()
Case $msg = $GUI_Button_SaveAs
  $oMZ.ExecWB(4,0)
EndSelect
WEnd
Exit
Func MZEvent_StatusTextChange($Text)
  GUICtrlSetData($Status_Label, $Text)
EndFunc
Func MZEvent_NavigateComplete($URL)
  GUICtrlSetData($GUI_URL, $URL)
EndFunc

Just a shame you cannot use object installed with current browser

IE's very stodgy for me.

The point of world view

Link to comment
Share on other sites

IE is great, just wishing on a star that ObjCreateInterface() might have had ability to

employ current and up to date mozilla or chrome browser objects.

Just my lack of savvy I suppose.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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