reader-checker 1.0

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

?View Code AUTOIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#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 Files\Adobe\Reader 8.0\Reader\plug_ins\Annots.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:\install\loggar\Adobe 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:\install\loggar\Adobe 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:\install\loggar\Adobe 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:\install\loggar\Adobe 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:\install\loggar\Adobe Reader 8.1.2.log"')
	Exit
EndIf