Sign in to follow this  
Followers 0
teunvisser

Version based installer

2 posts in this topic

Hi,

I've been working on some automated installers, but this time I want to make them more intelligent.

I've got the following script:

If FileExists(@ProgramFilesDir & "\Quicktime") Then
    MsgBox(0, "Install Test", "Quicktime is installed")
Else 
    MsgBox(0, "Quicktime", "Quicktime is not installed")
    MsgBox(4, "Quicktime", "Do you want to install Quicktime?")
    Select
    Case $msg = 6
            $msg = RunWait ("path to install file")
    EndSelect   
EndIf

But now it checks on the "Program Files\Quicktime" Directory.

I want to make it check on version!

So if an old version is installed I can easyly detect it.

How can i make it detect on version?

Like..

If Version is Not 1.0.0.1100 Then

Uninstall

after that

Install

Hope u can help me out,

Teun

Share this post


Link to post
Share on other sites



G'day Teun

This is a "quick and dirty" I put together the other night to install Java on a few machines.

Local $newVersion = "6.0.18"
Local $newInstaller = '"' & @ScriptDir & '\jre-6u18-windows-i586-s.exe" /passive MOZILLA=1 IEXPLORER=1 /norestart'


Local $version = FileGetVersion(@ProgramFilesDir & "\Java\jre6\bin\java.exe")

;MsgBox(0,"Version Compare","$newVersion = " & $newVersion & @cr & "$CurrentVersion = " & $version)

Local $LoadUpdate = false
if $version <> "0.0.0.0" Then
    for $item = 1 to StringLen($newVersion)  step 1
        if StringMid($newVersion,$item,1) < StringMid($Version,$item,1) then
            $LoadUpdate = True
            ExitLoop
        EndIf
    Next
Else
    $LoadUpdate = True
EndIf

if $LoadUpdate Then
    RunWait ($newInstaller, @TempDir)
EndIf

It should handle the situations where

- the file doesn't exist Version = "0.0.0.0".

- If the existing file is newer or same it it does nothing.

- If the existing file is older it will do the install.

Anyway hope it helps.

John Morrison

AKA

Storm-E

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
Sign in to follow this  
Followers 0