Stumpii

Automating Mozilla/Firefox

19 posts in this topic

#1 ·  Posted (edited)

I posted this about automating Mozilla (originator to Firefox) in the support forum earlier in response to a question, but as it is interesting and now a script/scrap, I thought I would put it here as well.

The following code shows simply how to use the Mozilla ActiveX control instead of the IE control on an AutoIt form. Checkout the homepage of the Mozilla ActiveX control here.

CODE

#include <GUIConstants.au3>

$oIE = ObjCreate("Mozilla.Browser.1")

; Create a simple GUI for our output

GUICreate ( "Embedded Web control Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$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", 330, 420, 100, 30)

GUISetState () ;Show GUI

$oIE.navigate("http://www.autoitscript.com")

; Waiting for user to close the window

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

$oIE = 0

ExitLoop

Case $msg = $GUI_Button_Home

$oIE.navigate("http://www.autoitscript.com")

Case $msg = $GUI_Button_Back

$oIE.GoBack

Case $msg = $GUI_Button_Forward

$oIE.GoForward

Case $msg = $GUI_Button_Stop

$oIE.Stop

EndSelect

Wend

GUIDelete ()

Exit

To get this to work, you need to first download the Mozilla ActiveX control from here. Then to be able to create on the fly in AutoIt, you need to unregister 'mozctl.dll' in the installation folder (C:\Program Files\Mozilla ActiveX Control v1.7.12 in my case) and register 'mozctlx.dll' in the same folder. To do this, open command prompt, navigate to the folder and type 'regsvr32 -u mozctl.dll' and then 'regsvr32 mozctlx.dll'.

The code should then run. The interface is the same as IE, so program with the IE control first, then swap for Mozilla.

Note that the control implements compatibility with IE4. Also I would say that anyone that wants a simple browser pane to show an HTML readme, etc. should take a look. If you want to examine the forms or HTML makeup of a webpage, then you are probably better off using IE.

Edited by Stumpii

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites



Nice work, thank you!

(That activeX control could be integrated :S)

Share this post


Link to post
Share on other sites

The following code shows simply how to use the Mozilla ActiveX control instead of the IE control on an AutoIt form. Checkout the homepage of the Mozilla ActiveX control here.

Yes! This is great. Gotta try. I am not using Iternet Explorer anymore!!!!! :)

If you want to examine the forms or HTML makeup of a webpage, then you are probably better off using IE.

Not so sure. It should ALWAYS be better to check them with BOTH browsers. IE only sites downgrade the companies image. They say the companies are acting simply as if they were stupid microsoft associates, thus missing a wide range of visitors running mac and linux operating systems.

It is not a religion war a company or a web developer should run into: it is a microsoft only dirty war. :)

Share this post


Link to post
Share on other sites

Then to be able to create on the fly in AutoIt, you need to unregister 'mozctl.dll' in the installation folder (C:\Program Files\Mozilla ActiveX Control v1.7.12 in my case) and register 'mozctlx.dll' in the same folder. To do this, open command prompt, navigate to the folder and type 'regsvr32 -u mozctl.dll' and then 'regsvr32 mozctlx.dll'.

Why do you have to do this? I installed this a while ago and just ran your script and it ran just fine.

Is there a way to run this with only a dll or doing a silent install?


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Sorry to revive this thread from the dead, but I just found this and was interested in embedding FF into my AutoIt GUI..

I downloaded & installed the http://www.iol.ie/%7Elocka/mozilla/MozillaControl1712.exe and successfully tested the script below..

But I'm having a few problems though interfacing the _IE UDF's with the FF Object though..!!

Stumpii Said "The interface is the same as IE, so program with the IE control first, then swap for Mozilla."

so this it what I did, but the _IELoadWaitTimeout keeps occurring with this message...

"--> IE.au3 V2.4-0 Warning from function _IELoadWait, $_IEStatus_LoadWaitTimeout"

because the _IENavigate($IE, "http://google.com") function doesn't seem to be returning the webpage load complete status or something because its probably looking to use IE instead or something, so then _IELoadWaitTimeout(15000) kicks in and ends the _IENavigate Function..??

So is there anyway to correct this issue or is embedding FF into a GUI still kinda sketchy right now..??

#NoTrayIcon
#include <IE.au3>
#include <Misc.au3>
_Singleton(@ScriptName)

$IE = ObjCreate("Mozilla.Browser.1")
_IELoadWaitTimeout(15000)
GUICreate("AAA", 1100, 800)
GUICtrlCreateObj($IE, 0, 0, 1100, 800)
GUISetState () ;Show GUI

While 1
_IENavigate($IE, "http://google.com", 1)
ToolTip("Finished Loading")
Sleep(5000)
WEnd

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

What are the other main properties then..??

Is there a list somewhere that explains them all..??

Edited by cypher175

Share this post


Link to post
Share on other sites

never heard of such a thing.. can you recommend one to me..??

Share this post


Link to post
Share on other sites

never heard of such a thing.. can you recommend one to me..??

It's been mentioned before, I'll look.

how would get this to work with the Mozilla ActiveX control..??

$GetFormTags = _IETagNameGetCollection($IE, 'FORM')
$NumFormTags = @extended
For $i = 0 to $NumFormTags - 1
    $FORM = _IETagNameGetCollection($IE, 'FORM', $i)
Next
You'll have to refer to the ActiveX control guide.

Share this post


Link to post
Share on other sites

Try this.

Or this

Note that you'll need to select File/View TypeLib... to load the DLL and see the COM interfaces.

WBD

Share this post


Link to post
Share on other sites

so has anyone else done all this before and has already got a list of working FF Functions..??

Share this post


Link to post
Share on other sites

It works for me, though:

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

; Example: Embedding an Mozilla Object inside an AutoIt GUI
;  Download Mozilla ActiveX Control 
;  from http://www.brothersoft.com/mozilla-activex-control-download-78221.html

$Mozilla = ObjCreate("Mozilla.Browser") ; Get the Mozilla ActiveX instance
if Not IsObj($Mozilla) then
  Msgbox(0,"Mozilla","Can't find Mozilla ActiveX Control")
endif

; Create a simple GUI for our output
GUICreate ( "Embedded Mozilla Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX         = GUICtrlCreateObj      ( $Mozilla,      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",    330, 420, 100,  30)

GUISetState ()       ;Show GUI

$Mozilla.navigate("http://www.autoitscript.com/forum/index.php?showtopic=95595")

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            $Mozilla.navigate("http://www.autoitscript.com/forum/")
        Case $msg = $GUI_Button_Back
            $Mozilla.GoBack
        Case $msg = $GUI_Button_Forward
            $Mozilla.GoForward
        Case $msg = $GUI_Button_Stop
            $Mozilla.Stop
    EndSelect
    
Wend

$Mozilla = 0
GUIDelete()

exit

You have to download Mozilla ActiveX Control from

http://www.brothersoft.com/mozilla-activex-control-download-78221.html

and install it, only.


The point of world view

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Here I am to stir the pot. I'm a noob, and I'm trying to use firefox instead of IE. The links above no longer work, so I don't know where to go to get the things necessary. Can someone help me please? I'm getting a small handle on things by reading forums, watching vids, and reading the help files, but it's all still a foreign language to me.

I'm not trying to build a program that I can interact with, but something that will login to a particular website, do a few straight forward things, wait for something to happen, do a few more things, and then comes an if/then situation, then some more straight forward stuff, and finally repeat. I don't know which sorts of functions I should use,....or anything. I'm so lost but I really need this to work for me. :( :( :( :(

If you would like the challenge, please email me and we can do this thing together.

timothy855 @gmail.com

Edited by timothy855

Share this post


Link to post
Share on other sites

See

Share this post


Link to post
Share on other sites

Welcome to Autoit and the forum!

Why did you necro this 4 year old thread?

Open a new one and you will get much more attention.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
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