Page 1 of 1

FireFox Homepage

Posted: Tue Sep 08, 2009 6:42 pm
by besko
I need change homepage in firefox browser and i have problem:

Code: Select all

Procedure.s FindFile(file.s, directory.s, recursive = 1)
  PathAddBackslash_(@directory)
  Protected result.s, dir = ExamineDirectory(#PB_Any, directory, file)
  If dir And NextDirectoryEntry(dir)
    result = directory + DirectoryEntryName(dir)
    FinishDirectory(dir)
  ElseIf recursive
    dir = ExamineDirectory(#PB_Any, directory, "")
    If dir
      While NextDirectoryEntry(dir) And Not result
        If DirectoryEntryType(dir) = #PB_DirectoryEntry_Directory And DirectoryEntryName(dir)<>"." And DirectoryEntryName(dir)<>".."
          result = FindFile(file, directory + DirectoryEntryName(dir), 1)
        EndIf
      Wend
      FinishDirectory(dir)
    EndIf
  EndIf
  ProcedureReturn result
EndProcedure
Result$ = GetHomeDirectory()
      optionspath.s = FindFile("prefs.js", Result$ + "Application Data\Mozilla\Firefox\Profiles\", 1)
      If OpenFile(1, optionspath.s)
        While Eof(1) = 0
          A$ = ReadString(1)
          posit.l = FindString(A$, "user_pref(" + Chr(34) + "browser.startup.homepage" + Chr(34) + "", 0)
          If posit.l>0
            B$ = "user_pref(" + Chr(34) + "browser.startup.homepage" + Chr(34) + "," + Chr(34) + "http://www.yan.ru/" + Chr(34) + ");"
            WriteString(1, B$)
            
          EndIf
          Debug A$
        Wend
        CloseFile(1)
      EndIf
Its not work :( write in different line :(

Posted: Tue Sep 08, 2009 9:57 pm
by Little John
Unfortunately it's not that easy ...

I'm ignoring the FindFile() stuff now, since that doesn't seem to be your problem.
Assuming you know where your desired file is, so you have its complete pathname, you can use this procedure ReplaceLine().

Regards, Little John