rbenner1184

Firefox 25 silent install

15 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

it seems like I have this error when the first commands are executed.

Share this post


Link to post
Share on other sites

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

It seems to be at this line, but i'm confused, because when i run this from the command line it works.

Share this post


Link to post
Share on other sites

it seems though when i omit this i still get this error. I have ommited several lines and they all return an error on line 94, but 94 is a comment the compiler shouldn't even read that.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
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!!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Thanks :)

Actually i just ran your script and get this error:

post-51674-0-20493400-1391029590_thumb.j

So you might want to reinstall autoit!

Edited by Neutro

Share this post


Link to post
Share on other sites

Thanks :)

Actually i just ran your script and get this error:

attachicon.gifClipboard02.jpg

So you might want to reinstall autoit!

Its odd, because i did yesterday i'm going to need to run a filecleanup on my machine maybe. i do alot of testing on it.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Using a virtual machine and snapshot stystem is a good way to always have a clean testing setup. You should try it :)

I'm using that now mostly, but before I was not. Your right it does work better thats for sure. its much cleaner. Thanks again! :bye:

Share this post


Link to post
Share on other sites

Switches don't work for me? Is there something specific that needs to be done? I've tried them all. Even in command prompt. A GUI still pops up.

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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