Jump to content

Firefox 25 silent install


Recommended Posts

I am attempting to do a silent install for my company for Firefox and lock down certain sites with a certain add ons. To lock it down i have copied the Mozilla directory from the profile that I have staged for testing. My concern is the error that I get, because I run the syntax error check and I don't receive any errors. Nor do I receive errors in my log that I am creating with the script. It just keeps telling me there is an illegal statement. I for the life can't figure out what that illegal statement is. I have attached a screen shot of the error and posted me code. Can anyone help me with this please?

#include <FileConstants.au3>

#NoTrayIcon
#RequireAdmin


$SilentInstall = False
$installDir = "C:\Admin\AppUpd\Browsers\Firefox"
$logFile = $installDir & "\" & @ScriptName & ".log"
$logFileSubApp = $installDir & "\" & @ScriptName & "_bundled_app.log"
$logEntries = 0
$appTitle = "Mozilla Firefox 25 Install Launcher"
$ret1 = 0
$fileName = "Firefox Setup.exe"
$versionCheck = "25.0"

;command options
;  <exe> /s
if $cmdLine[0] > 0 then
    for $a = 1 to $cmdLine[0]
        if StringLeft($cmdLine[$a],1) = "-" then
            $cmdLine[$a] = "/" & StringMid($cmdLine[$a],1)
        EndIf

        Switch $cmdLine[$a]
            Case "/s", "/q", "/silent", "/quiet"
                $SilentInstall = True

        EndSwitch
    Next
EndIf


;start the log
DirCreate($installDir)
_Log("Log Started.  SilentInstall = " & $SilentInstall & ", OS Architecture = " & @OSArch)
;_CheckIfAdmin()  ;not needed on most installs since the #requireadmin immediately prompts to run as admin
if not $SilentInstall then ProgressOn($appTitle,"Staging Files","Please Wait...",-1,-1,16)


_Log("Staging files")
FileInstall("install_flash_player_12_plugin.msi",$installDir & "\install_flash_player_12_plugin.msi",1)
FileInstall("Firefox Setup25.exe",$installDir & "\Firefox Setup25.exe",1)

;firefox must be closed if we are going to update it and install flash player
;_Log("Closing firefox")
;ProgressSet(50)
;ProcessClose("firefox.exe")


ProgressSet(100,"Installing Firefox 25")
RunWait('"' & $installDir & '\FirefoxSetup25.exe -ms"')
_Log("Install returned " & $ret1 & ", @err=" & @error & ", @ext=" & @extended)



;remove the original settings
Log("Deleting default settings")
FileDelete(@ProgramFilesDir & "\Mozilla Firefox\override.ini")
FileDelete(@ProgramFilesDir & "\Mozilla Firefox\mozilla.cfg")
FileDelete(@ProgramFilesDir & "\Mozilla Firefox\defaults\pref\local-settings.js")
DirRemove("C:\Program Files\Mozilla Firefox") OR DirRemove("C:\Program Files(x86)\Mozilla Firefox")
_Log("File delete returned " & $ret1 & ", @err=" & @error & ", @ext=" & @extended)

;import the default settings
_Log("Importing default settings")
FileInstall("override.ini",@ProgramFilesDir & "\Mozilla Firefox\override.ini",1)
FileInstall("mozilla.cfg",@ProgramFilesDir & "\Mozilla Firefox\mozilla.cfg",1)
FileInstall("local-settings.js",@ProgramFilesDir & "\Mozilla Firefox\defaults\pref\local-settings.js",1)
_Log("File install returned " & $ret1 & ", @err=" & @error & ", @ext=" & @extended)


$source = "\Mozilla Firefox  Version 25"
;$destination = @UserProfileDir & "\AppData\Roaming"

;customize firefox profile settings
ProgressSet(100,"deleting the old directory")
DirRemove(@UserProfileDir & "\AppData\Roaming\Mozilla", 1)
_Log("Directory remove returned " & $ret1 & ", @err=" & @error & ", @ext=" & @extended)

;customize firefox profile settings
ProgressSet(100,"Copying the appropriate files to directory")
DirCopy($source & "\Mozilla", @UserProfileDir & "\AppData\Roaming", $FC_OVERWRITE)
_Log("Directory copy returned " & $ret1 & ", @err=" & @error & ", @ext=" & @extended)

FileDelete(@DesktopCommonDir & "\Mozilla Firefox.lnk")
_Log("file delete returned" & $ret1 & ", @err=" & @error & ", @ext=" & @extended)

;now install flash player (firefox must be closed for this to work)
ProgressSet(100,"Checking and installing the Flash Player 12 Plugin")
;$flashVer = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin","DisplayVersion")
_Log("Installing flash player plugin")
RunWait('msiexec /qn /i"' & $installDir & '\install_flash_player_12_plugin.msi"',$installDir)
_Log("Install returned " & $ret1 & ", @err=" & @error & ", @ext=" & @extended)

ProgressOff()
exit

if not $SilentInstall Then
    MsgBox(64,$appTitle,"Install completed with return code " & $ret1,300)
EndIf


exit $ret1

post-83116-0-66635500-1391011730_thumb.p

Link to comment
Share on other sites

What do you get when you run the script uncompiled? And what's on line 94?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

94 is a comment thats whats crazy..lol. When I run it uncompiled it doesn't return any errors I can see.

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Y:\Ryan\Mozilla Firefox Version 25.0\Firefox Version 25.0 Install2.au3" /UserParams    
+>14:50:46 Starting AutoIt3Wrapper v.2.1.4.0 SciTE v.3.3.7.0 ;  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86    Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86)
>Running AU3Check (3.3.10.2)  from:C:\Program Files\AutoIt3
+>14:50:46 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files\AutoIt3\autoit3.exe "Y:\Ryan\Mozilla Firefox Version 25.0\Firefox Version 25.0 Install2.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
+>14:50:49 AutoIt3.exe ended.rc:0
>Exit code: 0    Time: 2.855
Edited by rbenner1184
Link to comment
Share on other sites

This line is incorrect:

 
DirRemove("C:\Program Files\Mozilla Firefox") OR DirRemove("C:\Program Files(x86)\Mozilla Firefox")

It should be:

 
if @OSArch == "X86" then DirRemove("C:\Program Files\Mozilla Firefox")
if @OSArch == "X64" then DirRemove("C:\Program Files\(x86)\Mozilla Firefox")
 

Make this change in your script, recompile it and tell me how it goes :)

Edited by Neutro
Link to comment
Share on other sites

This line is incorrect:

 
DirRemove("C:\Program Files\Mozilla Firefox") OR DirRemove("C:\Program Files(x86)\Mozilla Firefox")

It should be:

 
if @OSArch == "X86" then DirRemove("C:\Program Files\Mozilla Firefox")
if @OSArch == "X64" then DirRemove("C:\Program Files\(x86)\Mozilla Firefox")
 

Make this change in your script, recompile it and tell me how it goes :)

Good eye. Thanks that worked. Your a life saver!!

Link to comment
Share on other sites

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 2 years later...

You need to be more specific.
Which switches do you talk about? Which version of FireFox (I hope you do not talk about FF 25)? Can you post your script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
 Share

  • Recently Browsing   0 members

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