Jump to content

Need This Script


Recommended Posts


For firefox you'll need to edit pref.js in the user profile and set it there:

pref("browser.startup.homepage", "http://www.msfn.org");

For IE, it's a reg entry in HKCU:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
Startpage="http://www.msfn.org"

Begin by trying to make something, instead of asking other to make it.

Link to comment
Share on other sites

Begin by trying to make something, instead of asking other to make it.
Thanks bro. Its working. Any script for this. Actually I'm new in coding.
You have to make your own script using whatever scripting language works (or that you are learning). Google on the scripting language you want to learn and do a little "light reading". ;) (Doesn't VBS allow for all of the functions necessary?)

Try a Script that you think should work and if it doesn't then ask for help correcting it.

Link to comment
Share on other sites

This kind of script could be done in almost every script language and a google search would have at least showed how to do it for IE but depending on the OS it might be better to use one language or another.

Autoit can do it very easily (i saw you said in another post you did a silent install with it).

Link to comment
Share on other sites

  • 3 weeks later...

AutoIt approach:

#Include <Array.au3>
#Include <File.au3>

; Check if Mozilla Firefox x86 version is installed
If @OSArch = "X86" Then
$MozillaFirefoxCurrentVersion = RegRead("HKLM\SOFTWARE\Mozilla\Mozilla Firefox", "CurrentVersion")
$MozillaFirefoxInstallDirectory = RegRead("HKLM\SOFTWARE\Mozilla\Mozilla Firefox\" & $MozillaFirefoxCurrentVersion & "\Main", "Install Directory")
EndIf
If @OSArch = "X64" Then
$MozillaFirefoxCurrentVersion = RegRead("HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox", "CurrentVersion")
$MozillaFirefoxInstallDirectory = RegRead("HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\" & $MozillaFirefoxCurrentVersion & "\Main", "Install Directory")
EndIf
$MozillaFirefoxExecutableFile = FileExists($MozillaFirefoxInstallDirectory & "\firefox.exe")
If $MozillaFirefoxExecutableFile = 0 Then
MsgBox(0x40010, @ScriptName, "Mozilla Firefox is not installed! Please install it and then run this script!", 4)
Exit
EndIf

; Find Mozilla Firefox profile folder
If FileExists(@AppDataDir & "\Mozilla\Firefox\profiles.ini") Then
$Mozilla_Firefox_profile_folder = IniRead(@AppDataDir & "\Mozilla\Firefox\profiles.ini", "Profile0", "Path", "")
$Mozilla_Firefox_profile_folder = StringReplace($Mozilla_Firefox_profile_folder, "/", "\")
EndIf

; EDIT MOZILLA FIREFOX PREFERENCES FILE
$InputFile = @AppDataDir & "\Mozilla\Firefox\" & $Mozilla_Firefox_profile_folder & "\prefs.js"
; String to find
$StringToFind = '"browser.startup.homepage"'
; New home page address
$HomePageAddress = "" ; write the desired home page address (inside quotes), for example: http://www.google.com/
; Delete the current home page address
Global $Array
_FileReadToArray ($InputFile, $Array)
$Array = _DeleteHomePageAddress ($Array, $StringToFind)
_FileWriteFromArray ($InputFile, $Array, 1)
; Write a new home page address
$File = FileOpen($InputFile, 257) ; UTF8 encoding without BOM
FileWriteLine($File, 'user_pref("browser.startup.homepage", ' & '"' & $HomePageAddress & '"' & ');')
FileClose($File)

Func _DeleteHomePageAddress ($Array, $StringToFind)
Local $Item
For $Element In $Array
If StringInstr ($Element, $StringToFind) <> 0 Then
_ArrayDelete ($Array, $Item)
Else
$Item+=1
EndIf
Next
Return ($Array)
EndFunc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...