Funktion _MozRepl_Detector()

  • Hi,
    hier ein Script, welches überprüft ob MozRepl in einem Firefox Profil
    installiert ist. (Ausgabe True oder False)

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------
    AutoIt Version: 3.2.8.1
    Author: Thunder-man (Frank Michalski)

    Script Function: _MozRepl_Detector()
    Description: Überprüft ein Firefox Profil auf die MozRepl Erweiterung.
    default: $Profil = "default"
    Return values: True or False
    V 1.0 ==> 15.09.2007

    #ce ----------------------------------------------------------------------------

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

    ; [Example]
    ;~ $Result = _MozRepl_Detector()
    ;~ MsgBox(4096, "Result", $Result)

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

    Func _MozRepl_Detector($Profil = "default")
    Local $Ini_Pfad = @UserProfileDir & "\Anwendungsdaten\Mozilla\Firefox\"

    If $Profil = "" Then MsgBox(4096, "Error", "Bitte ein Profil angeben. ")
    $var = IniReadSectionNames($Ini_Pfad & "\profiles.ini")
    If @error Then
    MsgBox(4096, "", "Error occurred, probably no Firefox INI file.")
    Else
    For $i = 1 To $var[0]
    $Ini_ = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Name", "Error")
    If $Ini_ = $Profil Then
    $Pfad_folder = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Path", "Eror") ;Profil Ordner
    ExitLoop
    EndIf
    Next
    EndIf

    If StringLeft($Pfad_folder, 8) = "Profiles" Then
    If FileExists($Ini_Pfad & $Pfad_folder & "\extensions\mozlab@hyperstruct.net") Then
    Return True
    Else
    Return False
    EndIf
    Else
    If FileExists($Pfad_folder & "\extensions\mozlab@hyperstruct.net") Then
    Return True
    Else
    Return False
    EndIf
    EndIf
    EndFunc ;==>_MozRepl_Detector

    [/autoit]

    2 Mal editiert, zuletzt von thunder-man (2. August 2008 um 16:35)

  • Kleines Update, damit es auch mit nicht deutschen Win-Versionen funktioniert:

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    #cs
    AutoIt Version: 3.2.12.1
    Author: Thunder-man (Frank Michalski)

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

    Script Function: _MozRepl_Detector()
    Description: Überprüft ein Firefox Profil auf die MozRepl Erweiterung.
    default: $Profil = "default"
    Return values: True or False
    V 1.0 ==> 15.09.2007
    V 1.1 ==> 02.08.2008, updated by Stilgar (Thorsten Willert)
    changed the path-macro to @AppDataDir
    changed the ""-profil to "default"

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

    #ce
    ;===============================================================================

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

    ; [Example]
    ;~ $Result = _MozRepl_Detector()
    ;~ MsgBox(4096, "Result", $Result)

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

    Func _MozRepl_Detector($Profil = "default")
    Local $Ini_Pfad = @AppDataDir & "\Mozilla\Firefox\"

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

    If $Profil = "" Then $Profil = "default"
    $var = IniReadSectionNames($Ini_Pfad & "\profiles.ini")
    If @error Then
    MsgBox(4096, "", "Error occurred, probably no Firefox INI file.")
    Else
    For $i = 1 To $var[0]
    $Ini_ = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Name", "Error")
    If $Ini_ = $Profil Then
    $Pfad_folder = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Path", "Eror") ;Profil Ordner
    ExitLoop
    EndIf
    Next
    EndIf

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

    If StringLeft($Pfad_folder, 8) = "Profiles" Then
    If FileExists($Ini_Pfad & $Pfad_folder & "\extensions\mozlab@hyperstruct.net") Then
    Return True
    Else
    Return False
    EndIf
    Else
    If FileExists($Pfad_folder & "\extensions\mozlab@hyperstruct.net") Then
    Return True
    Else
    Return False
    EndIf
    EndIf
    EndFunc ;==>_MozRepl_Detector

    [/autoit]
  • Danke für das Update Stilgar. :)

    (Die Variabel $Pfad_folder muss noch deklariert werden)

    Einmal editiert, zuletzt von thunder-man (2. August 2008 um 16:40)

  • Bitte.

    Nachtrag, mit Deklaration und etwas kürzer:

    Spoiler anzeigen
    [autoit]

    msgbox(64, "", _MozRepl_Detector())

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

    ;===============================================================================AUT
    #cs
    AutoIt Version: 3.2.12.1
    Author: Thunder-man (Frank Michalski)

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

    Script Function: _MozRepl_Detector()
    Description: Überprüft ein Firefox Profil auf die MozRepl Erweiterung.
    default: $Profil = "default"
    Return values: True or False
    V 1.0 ==> 15.09.2007
    V 1.1 ==> 02.08.2008, updated by Stilgar (Thorsten Willert)
    changed the path-macro to @AppDataDir
    changed the ""-profil to "default"

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

    #ce
    ;===============================================================================

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

    ; [Example]
    ;~ $Result = _MozRepl_Detector()
    ;~ MsgBox(4096, "Result", $Result)

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

    Func _MozRepl_Detector($Profil = "default")
    Local $Ini_Pfad = @AppDataDir & "\Mozilla\Firefox\"

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

    If $Profil = "" Then $Profil = "default"
    Local $var = IniReadSectionNames($Ini_Pfad & "\profiles.ini")
    If @error Then
    MsgBox(4096, "", "Error occurred, probably no Firefox INI file.")
    Else
    For $i = 1 To $var[0]
    Local $Ini_ = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Name", "Error")
    If $Ini_ = $Profil Then
    Local $Pfad_folder = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Path", "Eror") ;Profil Ordner
    ExitLoop
    EndIf
    Next
    EndIf

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

    If StringLeft($Pfad_folder, 8) = "Profiles" Then
    Return FileExists($Ini_Pfad & $Pfad_folder & "\extensions\mozlab@hyperstruct.net")
    Else
    Return FileExists($Pfad_folder & "\extensions\mozlab@hyperstruct.net")
    EndIf
    EndFunc ;==>_MozRepl_Detector

    [/autoit]
  • Hey ho, sry dass ich das thema nochmal ausgrabe, aber bei mir gibt die funktion immer 0 zurück obwohl ich mozrepl installiert habe! Ist das einfach nur ein fehler, da seitdem schon eine neuere version von mozrepl/firefox aktuell ist oder wo liegt mein fehler?

  • Damals hies das AddOn noch MozLab - so geht's wieder:

    Spoiler anzeigen
    [autoit]

    msgbox(64, "", _MozRepl_Detector())

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

    ;===============================================================================AUT
    #cs
    AutoIt Version: 3.2.12.1
    Author: Thunder-man (Frank Michalski)

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

    Script Function: _MozRepl_Detector()
    Description: Überprüft ein Firefox Profil auf die MozRepl Erweiterung.
    default: $Profil = "default"
    Return values: True or False
    V 1.0 ==> 15.09.2007
    V 1.1 ==> 02.08.2008, updated by Stilgar (Thorsten Willert)
    changed the path-macro to @AppDataDir
    changed the ""-profil to "default"
    V1.2 ==> 03.03.2009, updated by Stilgar (Thorsten Willert)
    changed MozLab to MozRepl

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

    #ce
    ;===============================================================================

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

    ; [Example]
    ;~ $Result = _MozRepl_Detector()
    ;~ MsgBox(4096, "Result", $Result)

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

    Func _MozRepl_Detector($Profil = "default")
    Local $Ini_Pfad = @AppDataDir & "\Mozilla\Firefox\"

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

    If $Profil = "" Then $Profil = "default"
    Local $var = IniReadSectionNames($Ini_Pfad & "\profiles.ini")
    If @error Then
    MsgBox(4096, "", "Error occurred, probably no Firefox INI file.")
    Else
    For $i = 1 To $var[0]
    Local $Ini_ = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Name", "Error")
    If $Ini_ = $Profil Then
    Local $Pfad_folder = IniRead($Ini_Pfad & "\profiles.ini", $var[$i], "Path", "Eror") ;Profil Ordner
    ExitLoop
    EndIf
    Next
    EndIf

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

    If StringLeft($Pfad_folder, 8) = "Profiles" Then
    Return FileExists($Ini_Pfad & $Pfad_folder & "\extensions\mozrepl@hyperstruct.net")
    Else
    Return FileExists($Pfad_folder & "\extensions\mozrepl@hyperstruct.net")
    EndIf
    EndFunc ;==>_MozRepl_Detector

    [/autoit]

    geht mit Vista sollte mit Windows aber auch funktionieren :D

    2 Mal editiert, zuletzt von Stilgar (3. März 2009 um 12:55)

  • Erweitert um die automatische Installation von MozRepl:

    Spoiler anzeigen
    [autoit]

    msgbox(64, "", _MozRepl_Detector())

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

    ;===============================================================================
    #cs
    AutoIt Version: 3.2.12.1
    Author: Thunder-man (Frank Michalski)

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

    Script Function: _MozRepl_Detector()
    Description: Überprüft ein Firefox Profil auf die MozRepl Erweiterung und installiert diese im Bedarfsfall.
    default: $Profil = "default"
    Return values: True or False
    V 1.0 ==> 15.09.2007
    V 1.1 ==> 02.08.2008, updated by Stilgar (Thorsten Willert)
    changed the path-macro to @AppDataDir
    changed the ""-profil to "default"
    V1.2 ==> 03.03.2009, updated by Stilgar (Thorsten Willert)
    changed MozLab to MozRepl
    V2.0 ==> 17.03.2009, added intall-option for MozRepl by Stilgar (Thorsten Willert)

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

    #ce
    ;===============================================================================

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

    ; [Example]
    ;~ $Result = _MozRepl_Detector()
    ;~ MsgBox(4096, "Result", $Result)

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

    Func _MozRepl_Detector($sProfil = "default", $bInstall = True , $sXPI = "http://repo.hyperstruct.net/mozrepl/0.2/mozrepl.xpi")

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

    If $sProfil = "" Then $sProfil = "default"

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

    Local $sIni_Pfad = @AppDataDir & "\Mozilla\Firefox\"

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

    Local $var = IniReadSectionNames($sIni_Pfad & "\profiles.ini")
    If @error Then
    MsgBox(4096, "", "Error occurred, probably no Firefox INI file.")
    Else
    For $i = 1 To $var[0]
    Local $Ini_ = IniRead($sIni_Pfad & "\profiles.ini", $var[$i], "Name", "Error")
    If $Ini_ = $sProfil Then
    Local $sPfad_folder = IniRead($sIni_Pfad & "\profiles.ini", $var[$i], "Path", "Eror") ;Profil Ordner
    ExitLoop
    EndIf
    Next
    EndIf

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

    If $bInstall Then
    Local $sHKLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox"
    Local $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")
    Local $sCommand = StringFormat('"%s" "%s"',$sFFExe, $sXPI)
    EndIf

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

    If StringLeft($sPfad_folder, 8) = "Profiles" Then
    If FileExists($sIni_Pfad & $sPfad_folder & "\extensions\mozrepl@hyperstruct.net") Then
    Return 1
    Else
    If $bInstall Then Return Run($sCommand)
    Return 0
    EndIf
    Else
    If FileExists($sPfad_folder & "\extensions\mozrepl@hyperstruct.net") Then
    Return 1
    Else
    If $bInstall Then Return Run($sCommand)
    Return
    EndIf
    EndIf
    EndFunc ;==>_MozRepl_Detector

    [/autoit]

    Grüße
    Stilgar

  • Habe die Funktion mal aktualisiert. :)

    Spoiler anzeigen
    [autoit]

    ;===============================================================================
    #cs
    AutoIt Version: 3.3.8.1
    Author: Thunder-man (Frank Michalski)

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

    Script Function: _MozRepl_Detector()
    Description: Überprüft ein Firefox Profil auf die MozRepl Erweiterung und installiert diese im Bedarfsfall.
    default: $Profil = "default"
    Return values:
    1 = MozRepl found
    0 = MozRepl not found
    @error:
    -2 = profiles.ini not found (probably missing FF installation)
    -3 = profile not found
    Changelog:
    V 1.0 ==> 15.09.2007
    V 1.1 ==> 02.08.2008, updated by Stilgar (Thorsten Willert)
    - changed the path-macro to @AppDataDir
    - changed the ""-profil to "default"
    V1.2 ==> 03.03.2009, updated by Stilgar (Thorsten Willert)
    - changed MozLab to MozRepl
    V2.0 ==> 17.03.2009, added intall-option for MozRepl by Stilgar (Thorsten Willert)
    V2.1 ==> 15.03.2012, updated & modded for newer versions of FF and MozRepl (Stefano Della Volpe)
    #ce
    ;===============================================================================

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

    msgbox(64, "", _MozRepl_Detector(Default))

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

    Func _MozRepl_Detector($sProfil = "default", $bInstall = False , $sXPI = "https://addons.mozilla.org/firefox/downloads/file/138898/mozrepl-1.1-fx.xpi?src=dp-btn-primary")
    Local $sIni_Pfad = @AppDataDir & "\Mozilla\Firefox" , $sPfad_folder=""

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

    If $sProfil = "" Or $sProfil = Default Then $sProfil = "default"

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

    Local $var = IniReadSectionNames($sIni_Pfad & "\profiles.ini")
    If @error Then
    Return -2
    Else
    For $i = 1 To $var[0]
    Local $Ini_ = IniRead($sIni_Pfad & "\profiles.ini", $var[$i], "Name", "Error")
    If $Ini_ = $sProfil Then
    $sPfad_folder = IniRead($sIni_Pfad & "\profiles.ini", $var[$i], "Path", "")
    ExitLoop
    EndIf
    If $i = $var[0] And $sPfad_folder="" And $sProfil = "default" Then ;für deutsches Standardprofil
    $sProfil = "Standard-Benutzer"
    $i=1
    EndIf
    Next
    EndIf
    If $sPfad_folder = "" Then Return -3
    If FileExists($sIni_Pfad & "\" & $sPfad_folder & "\extensions\mozrepl@hyperstruct.net.xpi") Then
    Return 1
    Else
    If $bInstall Then
    Local $FF_version= RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox","CurrentVersion")
    Local $PathToFFExe= RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\" & $FF_version & "\Main","PathToExe")
    Local $sCommand = StringFormat('"%s" "%s"',$PathToFFExe, $sXPI)
    Run($sCommand)
    EndIf
    Return 0
    EndIf
    EndFunc ;==>_MozRepl_Detector

    [/autoit]

    MfG hellboy

    [autoit]

    Do
    _help($user)
    Until $questions = 0

    [/autoit]

    Meine Werke:
    Ste`s Web-Radio

    6 Mal editiert, zuletzt von hellboy3 (16. März 2012 um 08:48)