Jump to content

FireFox Unattended Setup


Recommended Posts

I'm working on a script to silently install FireFox with extensions and themes using the commandline installer for extensions and themes:

Various command line options are be available to perform advanced, troubleshooting or system administration tasks. Installation into the application directory is possible from the command line, intended to be used by administrators on multi-user systems. -install-global-extension "/path/to/extension" Installs the extension into the application directory. The parameter is the path to the extension. -install-global-theme "/path/to/theme" Same as above, but for themes. -safe-mode Launches the application with all extensions disabled, for that launch only. (Extensions are not loaded, but are not permanently disabled in the Extension Manager datasource).

Source: http://www.mozilla.org/projects/firefox/extensions/commandlineoptions.html

My script is the following:

#include <File.au3>

;RunWait('Firefox Setup 2.0.0.11.exe /S')
$FireFox = @ProgramFilesDir & '\Mozilla Firefox\firefox.exe'
$Addons = @ScriptDir & '\Addons'
$Extensions = _FileListToArray($Addons, '*.xpi')
$Themes = _FileListToArray($Addons, '*.jar')
For $i = 1 To $Extensions[0]
    $Extensions[$i] = $Addons & '\' & $Extensions[$i]
Next
For $i = 1 To $Themes[0]
    $Themes[$i] = $Addons & '\' & $Themes[$i]
Next
;RunWait($FireFox & ' -CreateProfile default')
For $i = 1 To $Extensions[0]
    RunWait($FireFox & ' -install-global-extension ' & $Extensions[$i])
    ProcessClose('Firefox.exe')
Next
For $i = 1 To $Themes[0]
    RunWait($FireFox & ' -install-global-theme ' & $Themes[$i])
    ProcessClose('Firefox.exe')
Next

two runwait commands are commented so if someone else runs it it will not re-install firefox or create a new profile

when i run the script I notice no new extensions or themes on my existing firefox

can someone help me troubleshoot this script and figureout whats wrong

the themes and extensions are in a folder in the script directory called Addons (referenced by $Addons = @ScriptDir & '\Addons')

Link to comment
Share on other sites

First off, i'm glad you are taking the route of using command line uptions unlike some boneheads who try to do this with mouseclicks and whatnot.

Second, you need the working directory on your runwait() calls.

@ProgramFilesDir & '\Mozilla Firefox\'

Link to comment
Share on other sites

The cmd already has a silent function why create another one?

I'm still not getting the reponse I need though

New Script:

#include <File.au3>

RunWait('Firefox Setup 2.0.0.11.exe /S')
ProcessClose('FireFox.exe')
$FireFox = @ProgramFilesDir & '\Mozilla Firefox\firefox.exe'
$Addons = @ScriptDir & '\Addons'
$Extensions = _FileListToArray($Addons, '*.xpi')
$Themes = _FileListToArray($Addons, '*.jar')
For $i = 1 To $Extensions[0]
    $Extensions[$i] = $Addons & '\' & $Extensions[$i]
Next
For $i = 1 To $Themes[0]
    $Themes[$i] = $Addons & '\' & $Themes[$i]
Next
RunWait($FireFox & ' -CreateProfile default', @ProgramFilesDir & '\Mozilla Firefox\')
ProcessClose('Firefox.exe')
For $i = 1 To $Extensions[0]
    RunWait($FireFox & ' -install-global-extension ' & $Extensions[$i], @ProgramFilesDir & '\Mozilla Firefox\')
    Sleep(2000)
    ProcessClose('Firefox.exe')
Next
For $i = 1 To $Themes[0]
    RunWait($FireFox & ' -install-global-theme ' & $Themes[$i], @ProgramFilesDir & '\Mozilla Firefox\')
    Sleep(2000)
    ProcessClose('Firefox.exe')
Next

I tried both what you said and put the sleep funciton in to see if I was closing firefox.exe before it could update proporly but still haveing issues

Link to comment
Share on other sites

According to Mozillas list of command line options, you need a FULL path to the extension wrapped in double quotes.

RunWait($FireFox & ' -install-global-extension "' & @ProgramFilesDir & '\Mozilla Firefox\' & $Extensions[$i] & '"', @ProgramFilesDir & '\Mozilla Firefox\')

You may want to rework your paths and save them as variables...

$folder = @ProgramFilesDir & '\Mozilla Firefox\'

$FireFox = 'firefox.exe'

RunWait($folder & $FireFox & ' -install-global-extension "' & $folder & $Extensions[$i] & '"', $folder)

EDIT: Put double quotes in red so they are easier to see.

EDIT: Fixed $folder var

Edited by weaponx
Link to comment
Share on other sites

Got the script working, Thanks to weaponx for helping me out

Enjoy

#include <File.au3>

;Declare Variables
$FireFoxDir = @ProgramFilesDir & '\Mozilla FireFox\'
$FireFoxExe = $FireFoxDir & 'FireFox.exe'
$AddonsDir = @ScriptDir & '\Addons\'
$AddonsFiles = _FileListToArray($AddonsDir)
$FireFoxSetup = 0

;Finding firefox setup
$ScriptEXEs = _FileListToArray(@ScriptDir, '*.exe', 1)
For $i = 1 To $Files[0]
    $CompanyName = FileGetVersion('FireFox.exe', 'CompanyName')
    $FileDescription = FileGetVersion('FireFox.exe', 'FileDescription')
    If $CompanyName = 'Mozilla' And $FileDescription = 'Firefox' Then $FireFox = $Files[$i]
Next

;Create full path array for later commands
For $i = 1 To $AddonsFiles[0]
    $AddonsFiles[$i] = $AddonsDir & $AddonsFiles[$i]
Next

;Install firefox
RunWait($FireFox & ' /S')
ProcessClose('FireFox.exe')

;create default profile
RunWait($FireFoxExe & ' -CreateProfile default', $FireFoxDir)
ProcessClose('FireFox.exe')

;install themes and extensions
For $i = 1 To $AddonsFiles[0]
    Switch StringRight($AddonsFiles[$i], 3)
        Case 'xpi'
            RunWait($FireFoxExe & ' -install-global-extension "' & $AddonsFiles[$i] & '"', $FireFoxDir)
        Case 'jar'
            RunWait($FireFoxExe & ' -install-global-theme "' & $AddonsFiles[$i] & '"', $FireFoxDir)
        Case Else
            Sleep(0)
    EndSwitch
    ;close firefox
    ProcessClose('FireFox.exe')
Next

Edit: Updated script to automatically find firefox setup file

Install.au3

Edited by AcidCorps
Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

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