; This program will set firefox to not auto-update itself $debug=False ; wait for Firefox to close because the prefs.js will be overwritten when Firefox closes and the changes we make will be lost ProcessWaitClose("firefox.exe") If FileExists( @AppDataDir & "\Mozilla\Firefox\profiles.ini" ) Then $var = IniRead(@AppDataDir & "\Mozilla\Firefox\profiles.ini", "Profile0", "Path", "NotFound") Else Exit EndIf ; replace the / in the Path with a backslash $var = StringReplace($var,"/","\") $preffile = @AppDataDir & "\Mozilla\Firefox\" & $var & "\prefs.js" ; if the file exists then open it if FileExists( $preffile ) Then $fh = FileOpen( $preffile, 0 ) $message = FileRead( $fh ) FileClose( $fh ) ; if the string doesn't exist we need to add it otherwise we make sure it is set to false If StringInStr( $message, "app.update.enabled" ) Then ; check to see if it is already false... if so just Exit If StringInStr( $message, "user_pref(""app.update.enabled"", true);" ) Then $message = StringReplace( $message, "user_pref(""app.update.enabled"", true)", "user_pref(""app.update.enabled"", false)") $update=True Else ; it is already false so just Exit Exit EndIf Else $message = StringReplace( $message, " */" & @CRLF & @CRLF, " */" & @CRLF & @CRLF & "user_pref(""app.update.enabled"", false);" & @CRLF ) $update=True EndIf Else Exit ; $message = "Prefs file does not exist." EndIf If $debug Then MsgBox(4096, "Result", $message) If $update Then ; we need to update the file $fh = FileOpen($preffile, 2) ; Check if file opened for writing OK If $fh = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($fh, $message) FileClose($fh) EndIf