Firefox update 3.6.14 Update ff.au3 FIX (64-Bit)

  • Heyho,

    ich glaube gestern oder vorgestern kam ein neues Firefox update raus.
    Seitdem funktionierte die _ffstart() funktion nicht mehr richtig.
    Das liegt daran das sich der Registrypfad in der 64-bit versin (win7) leicht geändert hat und die funktion __FFStartProcess nicht mehr die .Exe findet.

    Ich habe diese funktion ein wenig modifiziert indem ich sie für die 32 und 64 bit version angepasst habe.

    Spoiler anzeigen
    [autoit]

    ; #INTERNAL_USE_ONLY# ==========================================================
    ; Name ..........: __FFStartProcess
    ; Description ...: Starts the firefox.exe
    ; AutoIt Version : V3.3.0.0
    ; Syntax ........: __FFStartProcess([$sURL = "about:blank"[, $bNewWin = False[, $sProfile = "default"[, $bNoRemote = False[, $bHide = False[, $iPort = 4242[, $iTimeOut = 30000]]]]]]])
    ; Parameter(s): .: $sProfile - Optional: (Default = "default") :
    ; $bNewWin - Optional: (Default = false) :
    ; $bNoRemote - Optional: (Default = false) :
    ; $bHide - Optional: (Default = False) :
    ; $iPort - Optional: (Default = 4242) :
    ; $iTimeOut - Optional: (Default = 30000) : min. 2000ms
    ; Return Value ..: Success - 1
    ; Failure - 0
    ; @ERROR -
    ; @EXTENDED - PID from the firefox.exe
    ; Author(s) .....: Thorsten Willert
    ; Date ..........: Wed Nov 04 16:01:59 CET 2009
    ; ==============================================================================
    Func __FFStartProcess($sURL = "about:blank", $bNewWin = False, $sProfile = "default", $bNoRemote = False, $bHide = False, $iPort = 4242, $iTimeOut = 30000)

    [/autoit] [autoit][/autoit] [autoit]

    If StringInStr(@OSArch, "64") Then

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $sFuncName = "__FFStartProcess"

    [/autoit] [autoit][/autoit] [autoit]

    Local $PID = -1
    Local $sNoRemote = "", $sNewWin
    Local $sProcName = $_FF_PROC_NAME

    [/autoit] [autoit][/autoit] [autoit]

    If $sProfile = "default" Then
    $sProfile = ''
    Else
    $sProfile = ' -P "' & $sProfile & '"'
    EndIf
    If $bNoRemote Then $sNoRemote = "-no-remote"
    If $bNewWin Then $sNewWin = "-new-window"
    $sURL = '"' & $sURL & '"'
    If $iTimeOut < 2000 Then $iTimeOut = 2000

    [/autoit] [autoit][/autoit] [autoit]

    Local $sHKLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\3.6.14 (de)\Main" ;Persönliche Anpassung
    Local $sFFExe = RegRead($sHKLM & "\", "Install Directory") & "\Firefox.exe"
    If @error Then
    SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Error reading registry entry for FireFox." & @CRLF & _
    "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\*CurrentVersion*\Main\PathToExe" & @CRLF & _
    "Error from RegRead: " & @error))
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $sCommand = StringFormat('"%s" %s %s %s -repl %i %s', $sFFExe, $sNewWin, $sURL, $sNoRemote, $iPort, $sProfile)
    $PID = Run($sCommand)
    If $bHide Then BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iTimeOutTimer = TimerInit()
    While 1
    Sleep(2000)
    If ProcessExists($sProcName) Then ExitLoop
    If (TimerDiff($iTimeOutTimer) > $iTimeOut) Then
    SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, "Browser process not exists: " & $sProcName))
    BlockInput(0)
    Return 0
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    If $bHide Then
    Local $WINTITLE_MATCH_MODE = AutoItSetOption("WinTitleMatchMode", 4)
    WinWaitActive("[CLASS:MozillaUIWindowClass]")
    Sleep(500)
    WinSetState("[CLASS:MozillaUIWindowClass]", "", @SW_MINIMIZE)
    BlockInput(0)
    AutoItSetOption("WinTitleMatchMode", $WINTITLE_MATCH_MODE)
    Else
    Sleep(1000)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $_FF_COM_TRACE Then ConsoleWrite('__FFStartProcess: "' & $sCommand & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    SetExtended($PID)
    Return 1

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Else

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $sFuncName = "__FFStartProcess"

    [/autoit] [autoit][/autoit] [autoit]

    Local $PID = -1
    Local $sNoRemote = "", $sNewWin
    Local $sProcName = $_FF_PROC_NAME

    [/autoit] [autoit][/autoit] [autoit]

    If $sProfile = "default" Then
    $sProfile = ''
    Else
    $sProfile = ' -P "' & $sProfile & '"'
    EndIf
    If $bNoRemote Then $sNoRemote = "-no-remote"
    If $bNewWin Then $sNewWin = "-new-window"
    $sURL = '"' & $sURL & '"'
    If $iTimeOut < 2000 Then $iTimeOut = 2000

    [/autoit] [autoit][/autoit] [autoit]

    Local $sHKLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox"
    Local $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")
    If @error Then
    SetError(__FFError($sFuncName, $_FF_ERROR_GeneralError, "Error reading registry entry for FireFox." & @CRLF & _
    "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\*CurrentVersion*\Main\PathToExe" & @CRLF & _
    "Error from RegRead: " & @error))
    Return 0
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $sCommand = StringFormat('"%s" %s %s %s -repl %i %s', $sFFExe, $sNewWin, $sURL, $sNoRemote, $iPort, $sProfile)
    $PID = Run($sCommand)
    If $bHide Then BlockInput(1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iTimeOutTimer = TimerInit()
    While 1
    Sleep(2000)
    If ProcessExists($sProcName) Then ExitLoop
    If (TimerDiff($iTimeOutTimer) > $iTimeOut) Then
    SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, "Browser process not exists: " & $sProcName))
    BlockInput(0)
    Return 0
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    If $bHide Then
    Local $WINTITLE_MATCH_MODE = AutoItSetOption("WinTitleMatchMode", 4)
    WinWaitActive("[CLASS:MozillaUIWindowClass]")
    Sleep(500)
    WinSetState("[CLASS:MozillaUIWindowClass]", "", @SW_MINIMIZE)
    BlockInput(0)
    AutoItSetOption("WinTitleMatchMode", $WINTITLE_MATCH_MODE)
    Else
    Sleep(1000)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $_FF_COM_TRACE Then ConsoleWrite('__FFStartProcess: "' & $sCommand & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    SetExtended($PID)
    Return 1

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndFunc ;==>__FFStartProcess

    [/autoit]
  • Du hast hier ein Problem bemerkt, die Korrektur ist aber nicht ganz ordentlich gemacht ;) Die Versionsnummer ist z.B. nicht variabel außerdem solte man dann irgendwie zwischen x64 und x64 Version wählen können. (Ja es gibt eine 64bit-Testversion von FF)