Jump to content

Scripting Adobe Acrobat Install


Recommended Posts

This is what I have so far. At the end, you can see the "sleep(25000)" the only reason I do that is because after the Runwait finishes, there is something else that does something...not quite sure what...if I don't sleep, the next item that is to be installed fails because msiexec isn't finished for some reason. can someone take a look at the installer and tell me what you think? I am using the adobe 7.0.9 version that can be found here. http://www.adobe.com/products/acrobat/read...llversions.html Anyway...here is the code I have for it. disregard the Debug lines, writing to a log file with that with an include. Please help refine this function. Thanks!

Func InstallAcrobat($dummy)
    ;Debug
    If $KMCDebug == 2 or 3 Then DebugMessage('Adobe Acrobat 7.0: ','Entering Function')
        
    ;Declare Variables
    $szAcrobatInstallerSource = $szInstallFilesSource & 'Adobe\AdbeRdr70_enu_full.exe'
    $szAcrobatFileCheck = 'C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrofx32.dll'  
    
    ;Check to see if Acrobat 7 is already installed
    If $KMCDebug == 2 or 3 Then DebugMessage('__Adobe Acrobat 7.0: ','Check if Adobe is already installed ...')
    If FileExists("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32") Then
    EndIf 
    
    ;Copy .exe to Temp folder
    If $KMCDebug == 2 or 3 Then DebugMessage('__Adobe Acrobat 7.0: ','Copy installer to local directory ...')
    FileCopy($szAcrobatInstallerSource,$szLocalTempDir & 'Acrobat.exe',1)
    
    ;Run Installer with unattended switch
    If $KMCDebug == 2 or 3 Then DebugMessage('__Adobe Acrobat 7.0: ','Run install string ...')
    ;_RunDOS("C:\Temp\Acrobat.exe /v/qn/norestart")
    RunWait(@ComSpec & ' /c C:\Temp\Acrobat.exe /v/qn/norestart')
    
    ;Wait for installer window to close
    WinWaitClose("Adobe Reader 7.0")

    ;Delete temp installer file
    If $KMCDebug == 2 or 3 Then DebugMessage('__Adobe Acrobat 7.0: ','Remove installer ...')
    FileDelete($szLocalTempDir & 'Acrobat.exe')
    
    ;Sleeping to allow installer to finish
    Sleep(25000)   ;<<----- Need to fix this. Use FileMon to find last file installed.

    ;Log Install
    _LogCheck("2","Acrobat 7.0",$szAcrobatFileCheck)
    
    ;Debug
    If $KMCDebug == 2 or 3 Then DebugMessage('Adobe Acrobat 7.0: ','Exiting Function')
EndFunc

Edit

Edited by dufran3
Link to comment
Share on other sites

ah a network. I think there is actually a program that wil allow you to do that throught the network. or if not you can make an ISO of a master computer and copy it to the rest of em :rolleyes:

Sorry for the un helpful posts. i have no idea :rambo:

Link to comment
Share on other sites

ProcessWaitClose("msiexec.exe")

Would that work in place of your SLeep?

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

I have already done this for my organisation. The following snippet is from my installer script. There is quite a bit more, but this is the relevant part. B-)

; Now Install Adobe Acrobat Reader
Func InstallAcrobatReader()
    
    Local $AlreadyInstalled = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A70900000002}", "DisplayName")
    If @error Then ; Not already installed, need to install from scratch
    ;   _LogThis("NOT ALREADY INSTALLED")
        ;           $appName,               MSI_location,               MSI_Parameters,                                 Switch (/i for install, /p for patch)
        MSI_Install($PackageName, "\Adobe Reader 7.0.9.msi", "/qb /norestart /log C:\Temp\AdbeRdr709_en_US.log ALLUSERS=2 EULA_ACCEPT=YES", "/i")
    Else ; Software *is* already installed, thus need to repair.
    ;   _LogThis("Already Installed - attempting repair ")
        MSI_Install($PackageName, "\Adobe Reader 7.0.9.msi", "/qb /log C:\Temp\AdbeRdr709_en_US.log ALLUSERS=2 EULA_ACCEPT=YES /norestart", "/fav")
    EndIf
    
    ;Patch_Install("Patches", @ScriptDir)
    
EndFunc   ;==>InstallAcrobatReader

; Take the location of the .msi and the MSI parameters then run the msiexec.
Func MSI_Install($app, $MSI_location, $MSI_params, $switch)
    ;If $TallyOrDo= "Tally" Then ; increment the function tally for use with the Progressbar
    ;   $FunctionCount = $FunctionCount + 1
    ;Else ; Execute the function
    ;   _ShowProgress("Installing " & $app)
        ;MsgBox(0, "MSI String", 'MsiExec.exe ' & $switch & ' "' & @ScriptDir & $MSI_location & '" ' & $MSI_params)
        If FileExists(@ScriptDir & $MSI_location) Then
            _LogThis("    Installing " & $MSI_location & " - ")
            RunWait(@ComSpec & " /c " & 'MsiExec.exe ' & $switch & ' "' & @ScriptDir & $MSI_location & '" ' & $MSI_params, @TempDir, @SW_HIDE)
            _LogThis("      Install complete for " & $MSI_location & " - ")
        Else
            _LogThis("    Error!!! " & @ScriptDir & $MSI_location & " not found!")
        EndIf
    ;EndIf
EndFunc   ;==>MSI_Install

I've commented out the non relevant lines. I check the registry for an existing key to determine if it's installed or not.

Link to comment
Share on other sites

first thing I want to say it's incredible bad practise to sleep a fixed amount of time, it's useless (what if you're behind a superfast PC, or a superslow one)

you need to open a dosbox and kill process manually.. once you did that you know the close command..

look:

I don't know if you're aware but acrobat reader is the easiest package to create a silent install from...

open explorer

browse to %tmp%

delete all crap you don't need.

start setup.exe

watch files and folders be created in %tmp% (still works with acroread 8.0)

don't click next on welcome screen.

copy files from %tmp% to source folder

there you have MSI.

you can say in your script:

if ProcessExists("msiexec.exe") Then

ProcessClose("msiexec.exe")

EndIf

or

if ProcessExists("msiexec.exe") Then

run(@ComSpec & " /c " & 'taskkill /F /IM msiexec*')

EndIf

Edited by lordofthestrings
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...