Search code examples
autoit

Convert code to open Firefox instead of Internet Explorer


How do I change Internet Explorer to Firefox?

#include <IE.au3>
    Func _CreateIE()
        If Not IsObj($oIE) Or Not ProcessExists("iexplore.exe") Then
            $oIE = _IECreate($sURL, 0)
        EndIf
    EndFunc   ;==>_CreateIE

Solution

  • To just open the Firefox browser the following native AutoIt code suffices:

    local $url="www.google.com"
    $off=Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe " & $url, "", @SW_MAXIMIZE)
    

    For full support you'll need the user defined function FF.au3, which in turn requires the add-on mozrepl.

    Don't forget to start MozRepl. FF-menu: Extras/Menu or check there "Activate on startup".

    Then you can do:

    #Include <FF.au3>
    _FFStart([$sURL = "about:blank"[, $sProfile = "default"[, $iMode = 1[, $bHide = False[, $IP = "127.0.0.1"[, $iPort = 4242]]]]]])
    

    References:
    http://english.documentation.ff-au3.thorsten-willert.de
    https://www.autoitscript.com/wiki/User_Defined_Functions
    https://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/
    https://github.com/bard/mozrepl/wiki