Jump to content

Adobe Reader - Installer/Updater


storme
 Share

Recommended Posts

Thought someone might find this useful

All you have to do is download AdbeRdr930_en_US.exe and AdbeRdrUpd932_all_incr.msp from Adobe put them and this program in the same directory and run this file. Afterward you should have Adobe reader installed and at version 9.3.2.

I've just done a rewrite on it from a more basic version so if you find any problems please let me know.

It's only been tested on Windows XP and Windows 7 32 bit. If you have a different OS and it doesn't work give me some details and if you've worked it out the solution. :idea:

If I find any problems I'll release an upgrade.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=Adobe Reader Installer/Updater
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;===============================================================================
;
;   Adobe Reader Installer/Updater
;
; Description:   Checks the version of the Adobe Reader you have installed and loads
;                the apporpriate file to upgrade it to the most recent.
;
; Author(s):     John Morrison aka Storm-E
;
;===============================================================================


Local $installer = @ScriptDir & "\AdbeRdr930_en_US.exe"
Local $installerCommandLine = '/sPB /rs /l /msi"/qb-! /norestart ALLUSERS=2 EULA_ACCEPT=YES SUPPRESS_APP_LAUNCH=YES"'
Local $installerVersion = "9.3" ; Use to override reading version of installer file

Local $program = @ProgramFilesDir & "\Adobe\Reader 9.0\Reader\AcroRd32.exe"

;main program
installProgram($installer, $installerCommandLine, $program, $installerVersion)

;update
installProgram(@ScriptDir & "\AdbeRdrUpd932_all_incr.msp", "/quiet /norestart", $program, "9.3.2")

RegWrite('HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\AdobeViewer', 'TrustedMode', 'REG_DWORD', '00000000')
RegWrite('HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\AdobeViewer', 'EULA', 'REG_DWORD', '00000001')
RegWrite('HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\AdobeViewer', 'Launched', 'REG_DWORD', '00000001')
RegWrite('HKEY_LOCAL_MACHINE\Software\Adobe\Acrobat Reader\9.0\AdobeViewer', 'EULA', 'REG_DWORD', '00000001')
RegWrite('HKEY_LOCAL_MACHINE\Software\Adobe\Acrobat Reader\9.0\AdobeViewer', 'Launched', 'REG_DWORD', '00000001')
RegDelete('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'Adobe Reader Speed Launcher')

Exit

Func installProgram($installer, $installerCommandLine, $program, $installerVersion)
    Local $verInstaller
    If $installerVersion = "" Then
        $verInstaller = FileGetVersion($installer)
    Else
        $verInstaller = $installerVersion
    EndIf

    Local $verProgram = FileGetVersion($program)

    Local $LoadUpdate = False
    If $verProgram = "0.0.0.0" Or _CompareVersions($verInstaller, $verProgram) = 1 Then
        ;ConsoleWrite("LOAD installer " & $installer & @CR)
        Return ShellExecuteWait($installer, $installerCommandLine, @TempDir, "open")
    EndIf
    Return 0
EndFunc   ;==>installProgram

;===============================================================================
;
; FunctionName:   _CompareVersions()
; Description:   Compare 2 strings in FileGetVersion format [a.b.c.d].
; Syntax:         _CompareVersions( $s_Version1, $s_Version2)
; Parameter(s):  $s_Version1  - Version 1 string to be compared
;                $s_Version2  - Version 1 string to be compared
; Requirement(s):   None
; Return Value(s):
;                   0 - Verions are the same with the same length
;                  -1 - First string is lower than second string
;                   1 - First string is higher than than second string
;                  If versions aren't the same length but all existing sections match (eg 9.3 - 9.3.2)
;                  -1 - First string is shorter than second string (9.3 < 9.3.2)
;                   1 - First string is Longer than than second string (9.3.2 > 9.3)
;
; Author(s):        John Morrison aka Storm-E
; Note(s):        Will compare versions in numeric (9.3) or alpha format (9.c)
;
;===============================================================================
Func _CompareVersions($sVersion1, $sVersion2)

    ;Split strings into component version parts
    Local $asVersion1 = StringSplit($sVersion1, ".")
    Local $asVersion2 = StringSplit($sVersion2, ".")

    ;
    Local $iElements = $asVersion1[0]
    If $asVersion1[0] > $asVersion2[0] Then
        $iElements = $asVersion2[0]
    EndIf

    For $iElement = 1 To $iElements
        ;ConsoleWrite("Ver1[" & $iElement &"] = " & $asVersion1[$iElement] & "Ver2[" & $iElement &"] = " & $asVersion2[$iElement] & @CR)
        ;Check if numeric version numbers (assume both verions follwo same pattern)
        If StringIsDigit($asVersion1[$iElement]) Then
            If Number($asVersion1[$iElement]) < Number($asVersion2[$iElement]) Then
                Return -1
            ElseIf Number($asVersion1[$iElement]) > Number($asVersion2[$iElement]) Then
                Return 1
            EndIf
        Else
            ; Alpher version system (ie A-Z)
            If $asVersion1[$iElement] < $asVersion2[$iElement] Then
                Return -1
            ElseIf $asVersion1[$iElement] > $asVersion2[$iElement] Then
                Return 1
            EndIf
        EndIf
    Next
    ;Version numbers are equal
    ;Compare version lengths (eg 9.3 < 9.3.2)
    If $asVersion1[0] > $asVersion2[0] Then
        Return 1
    ElseIf $asVersion1[0] < $asVersion2[0] Then
        Return -1
    EndIf
    Return 0 ; versions are equal

EndFunc   ;==>_CompareVersions

Have fun!

John Morrison

aka

Storm-E

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...