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
; #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)
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
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
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
Local $sCommand = StringFormat('"%s" %s %s %s -repl %i %s', $sFFExe, $sNewWin, $sURL, $sNoRemote, $iPort, $sProfile)
$PID = Run($sCommand)
If $bHide Then BlockInput(1)
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
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
If $_FF_COM_TRACE Then ConsoleWrite('__FFStartProcess: "' & $sCommand & @CRLF)
[/autoit] [autoit][/autoit] [autoit]SetExtended($PID)
Return 1
Else
[/autoit] [autoit][/autoit] [autoit]Local Const $sFuncName = "__FFStartProcess"
[/autoit] [autoit][/autoit] [autoit]Local $PID = -1
Local $sNoRemote = "", $sNewWin
Local $sProcName = $_FF_PROC_NAME
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
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
Local $sCommand = StringFormat('"%s" %s %s %s -repl %i %s', $sFFExe, $sNewWin, $sURL, $sNoRemote, $iPort, $sProfile)
$PID = Run($sCommand)
If $bHide Then BlockInput(1)
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
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
If $_FF_COM_TRACE Then ConsoleWrite('__FFStartProcess: "' & $sCommand & @CRLF)
[/autoit] [autoit][/autoit] [autoit]SetExtended($PID)
Return 1
EndIf
EndFunc ;==>__FFStartProcess