• Home
  • Contact
bogge.info

The brain dump of bogge.

  • Contact
  • Blog
    • Computer
    • Food
    • Fun stuff
    • Graphic
    • msi
    • Pirate
      • Scripting
        • AutoIT
        • Crystal syntax
        • Etomite CMS
        • HTML
        • PHP
        • VBScript
    • Software
  • Photo
    • Interior
    • Landscape
    • Nature
    • Sky

reader-checker 1.0

Posted on January 13, 2010 by bogge

AutoIT script gets file version from a file and depending on the version different actions is taken.

#cs ----------------------------------------------------------------------------
 Script: reader-checker 1.0
 AutoIt Version: 3.2.12.1
 Author:         Bogge @ Bogge.com
 
 Script Function:
	Script gets file version from a file and depending on the version different actions is taken.
	Script also adds the result of the script in a local log file.
 
#ce ----------------------------------------------------------------------------
 
;Get file version from file.
$ver = FileGetVersion ( "C:Program FilesAdobeReader 8.0Readerplug_insAnnots.api")
 
;Paths depending on delivery
$rospath = 'C:temp' ;End with 
$mcastpath = 'C:temp' ;End with 
 
If $CmdLine[1] = 'ros' Then
	$path = $rospath
 
ElseIf $CmdLine[1] = 'mcast' Then
	$path = $mcastpath
 
Else
	$path = $rospath
EndIf
 
;Take different actions depending on the file version
 
If $ver = "0.0.0.0" Then 
	;Is probably a error if file version is 0.0.0.0
	RunWait(@COMSPEC & ' /c echo === ERROR: File version is '&$ver&' === >> "C:installloggarAdobe Reader 8.1.2.log"')
	Exit
 
ElseIf $ver < "8.1.0.137" Then 
	;If version is no 0.0.0.0 and lower than 8.1.0.137 Then we must first Install the newer version and then add the Patch.
	RunWait(@COMSPEC & ' /c echo === OK: ('&$ver&') Upgrade and Patch === >> "C:installloggarAdobe Reader 8.1.2.log"')
	RunWait('msiexec transforms="'&$path&'AdobeReader8.12.1.00.mst" /i "'&$path&'AdobeReader8.12.1.00.msi" /qb') ;Install new version
	RunWait('msiexec transforms="'&$path&'AdobeReader_SU18.12.1.00.mst" /i "'&$path&'AdobeReader_SU18.12.1.00.msi" /qb') ;Patch
	Exit
 
ElseIf $ver = "8.1.0.137" Then 
	;If version is 8.1.0.137 then add the patch
	RunWait(@COMSPEC & ' /c echo === OK: ('&$ver&') Patch === >> "C:installloggarAdobe Reader 8.1.2.log"')
	RunWait('msiexec transforms="'&$path&'AdobeReader_SU18.12.1.00.mst" /i "'&$path&'AdobeReader_SU18.12.1.00.msi" /qb') ;Patch
	Exit
 
ElseIf $ver >= "8.1.2.215" Then 
	;If version is greater or equal 8.1.2.215 the do nothing.
	RunWait(@COMSPEC & ' /c echo === OK: ('&$ver&') Already patched or newer version. Do nothing. === >> "C:installloggarAdobe Reader 8.1.2.log"')
	Exit
 
Else
	;If nothing else is correct the is an error
	RunWait(@COMSPEC & ' /c echo === ERROR: Version is not valid. Version is ('&$ver&') === >> "C:installloggarAdobe Reader 8.1.2.log"')
	Exit
EndIf
This entry was posted in AutoIT and tagged AutoIT, file, log, script, version. Bookmark the permalink
  • Connect with us:
  • RSS
  • © 2021 www.bogge.com
  • bogge.com | bogge.eu | bogge.tv