Jump to content
Sign in to follow this  
ScubaSteve

Nedd Serious Help

Recommended Posts

ScubaSteve

Ok I wrote a small script for installing two sequential releasees of product (there is a bug where you have to install the first version before installing the second.) Now I am having an issue where some people have the first version already installed.

I need help with conditional statements and functions.

First:

I need to check if a file exists first and if this file exists then check the version. if the version is 9.x.x.x.x.x. then I need to install version 10 of this client.

If the file does not exists or does not = 9.x.x.x.x.x.x.x. of this file then I need to proceed with my original script.

Original script

ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")

For $i = 1 to 49 step 1

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

Run(9_0.msi /qn Allow_Reboot=No)

WinWaitActive("Installer Information")

Send("!n")

ProgressSet(50 , "Almost Done", "Installation In Progress, Please Wait")

For $i = 50 to 99 step 1

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

Run(10_0.msi /qn Allow_Reboot=No)

ProgressSet(100 , "Done", "Complete")

sleep(500)

ProgressOff()

Share this post


Link to post
Share on other sites
ScubaSteve

In the helpfile, which comes with the AutoIt installation, look for FileExists and FileGetVersion

Welcome to the AutoIt forums

Heres what I came up with but Im new to this stuff and dont know how to call a function etc

GetVer()

Install9to10()

Upgradeto10()

If FileExists("C:\Program Files\Citrix\ICA Client\Wfica32.EXE")

Else Install9to10()

Endif

Func GetVer()

$ver = FileGetVersion("C:\Program Files\Citrix\ICA Client\Wfica32.EXE")

if $ver = "9.*" then Upgradeto10

EndFunc

Func Install9to10

Run("msiexec /i 9_0.msi")

ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")

For $i = 1 to 24 step 1

sleep(1500)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(25 , "Working", "Installation In Progress, Please Wait")

For $i = 25 to 49 step 1

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

WinWaitActive("Installer Information")

Send("!n")

Run("msiexec /i 10_0.msi")

ProgressSet(50 , "Additional Configuration", "Installation In Progress, Please Wait")

For $i = 50 to 74 step 1

sleep(1800)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(75 , "Almost Done", "Installation In Progress, Please Wait")

For $i = 75 to 99 step 1

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

WinWaitActive("Installer Information")

ProgressSet(100 , "Done", "Complete")

sleep(100)

ProgressOff()

EndFunc

Func Upgradeto10

Run("msiexec /i 10_0.msi")

EndFunc

Share this post


Link to post
Share on other sites
Kerros

So I'm taking a guess at what is happening here.

Getver was checking to see if the program was installed and if it was just run upgradeto10. If it was not, the script needs to run install9to10.

I ran Tidy within the SciTE tools menu to help clean up the code a bit, you had forgotten to include brackets () after a couple of the functions. No worries it happens.

CODE
If FileExists("C:\Program Files\Citrix\ICA Client\Wfica32.EXE") Then

$version = FileGetVersion("C:\Program Files\Citrix\ICA Client\Wfica32.EXE")

If $version = "9.*" Then

Upgradeto10()

EndIf

Else

Install9to10()

EndIf

Func Install9to10()

Run("msiexec /i 9_0.msi")

ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")

For $i = 1 To 24 Step 1

Sleep(1500)

ProgressSet($i, $i & " percent")

Next

ProgressSet(25, "Working", "Installation In Progress, Please Wait")

For $i = 25 To 49 Step 1

Sleep(1000)

ProgressSet($i, $i & " percent")

Next

WinWaitActive("Installer Information")

Send("!n")

Run("msiexec /i 10_0.msi")

ProgressSet(50, "Additional Configuration", "Installation In Progress, Please Wait")

For $i = 50 To 74 Step 1

Sleep(1800)

ProgressSet($i, $i & " percent")

Next

ProgressSet(75, "Almost Done", "Installation In Progress, Please Wait")

For $i = 75 To 99 Step 1

Sleep(1000)

ProgressSet($i, $i & " percent")

Next

WinWaitActive("Installer Information")

ProgressSet(100, "Done", "Complete")

Sleep(100)

ProgressOff()

EndFunc ;==>Install9to10

Func Upgradeto10()

Run("msiexec /i 10_0.msi")

EndFunc ;==>Upgradeto10


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites
ScubaSteve

So I'm taking a guess at what is happening here.

Getver was checking to see if the program was installed and if it was just run upgradeto10. If it was not, the script needs to run install9to10.

I ran Tidy within the SciTE tools menu to help clean up the code a bit, you had forgotten to include brackets () after a couple of the functions. No worries it happens.

CODE
If FileExists("C:\Program Files\Citrix\ICA Client\Wfica32.EXE") Then

$version = FileGetVersion("C:\Program Files\Citrix\ICA Client\Wfica32.EXE")

If $version = "9.*" Then

Upgradeto10()

EndIf

Else

Install9to10()

EndIf

Func Install9to10()

Run("msiexec /i 9_0.msi")

ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")

For $i = 1 To 24 Step 1

Sleep(1500)

ProgressSet($i, $i & " percent")

Next

ProgressSet(25, "Working", "Installation In Progress, Please Wait")

For $i = 25 To 49 Step 1

Sleep(1000)

ProgressSet($i, $i & " percent")

Next

WinWaitActive("Installer Information")

Send("!n")

Run("msiexec /i 10_0.msi")

ProgressSet(50, "Additional Configuration", "Installation In Progress, Please Wait")

For $i = 50 To 74 Step 1

Sleep(1800)

ProgressSet($i, $i & " percent")

Next

ProgressSet(75, "Almost Done", "Installation In Progress, Please Wait")

For $i = 75 To 99 Step 1

Sleep(1000)

ProgressSet($i, $i & " percent")

Next

WinWaitActive("Installer Information")

ProgressSet(100, "Done", "Complete")

Sleep(100)

ProgressOff()

EndFunc ;==>Install9to10

Func Upgradeto10()

Run("msiexec /i 10_0.msi")

EndFunc ;==>Upgradeto10

Thats exactly what Im tryuing to do. Im going to try this first thing in the morning. Thanks So Much for your help. <_<

Share this post


Link to post
Share on other sites
ScubaSteve

OK

now I have a list of versions in the 9.x client and I cant get the script to work. Can you guys help me out??

If FileExists("C:\Program Files\Citrix\ICA Client\Wfica32.EXE") Then
$version = FileGetVersion("C:\Program Files\Citrix\ICA Client\Wfica32.EXE")
If $version = "9.0.32649.0" Then 
    Upgradeto10()
    EndIf
If $version = "9.100.36280" Then 
    Upgradeto10()
    EndIf
If $version = "9.150.39151" Then
    Upgradeto10()
    EndIf
If $version = "9.200.44376" Then 
    Upgradeto10()
    EndIf
If $version = "9.230.50211" Then
    Upgradeto10()
    EndIf
If $version = "9.237.53063" Then
    Upgradeto10()
    EndIf
Else
Install9to10()
EndIf
Func Install9to10()
ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")
For $i = 1 to 49 step 1
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
Run("msiexec /i 9_0.msi")
WinWaitActive("Installer Information")
Send("!n")
ProgressSet(50 , "Almost Done", "Installation In Progress, Please Wait")
For $i = 50 to 99 step 1
    sleep(1000)
 ProgressSet( $i, $i & " percent")
Next
Run("msiexec /i 10_0.msi")
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
EndFunc;==>Install9to10
Func Upgradeto10()
ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")
Run("msiexec /i 10_0.msi")
For $i = 1 to 80 step 1
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
EndFunc;==>Upgradeto10

Share this post


Link to post
Share on other sites
ScubaSteve

OK This looks like it is working I have to do some more with control click etc but I think this is looking promising.

If FileExists("C:\Program Files\Citrix\ICA Client\Wfica32.EXE") Then
$version = FileGetVersion("C:\Program Files\Citrix\ICA Client\Wfica32.EXE")
If $version = "9.0.32649.0" Then 
    Upgradeto10()
ElseIf $version = "9.100.36280" Then 
    Upgradeto10()
ElseIf $version = "9.150.39151" Then
    Upgradeto10()
ElseIf $version = "9.200.44376" Then 
    Upgradeto10()
ElseIf $version = "9.230.50211" Then
    Upgradeto10()
ElseIf $version = "9.237.53063" Then
    Upgradeto10()
Else
Install9to10()
EndIf
EndIf
Func Install9to10()
ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")
For $i = 1 to 49 step 1
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
Run("msiexec /i 9_0.msi")
WinWaitActive("Installer Information")
Send("!n")
ProgressSet(50 , "Almost Done", "Installation In Progress, Please Wait")
For $i = 50 to 99 step 1
    sleep(1000)
 ProgressSet( $i, $i & " percent")
Next
Run("msiexec /i 10_0.msi")
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
EndFunc;==>Install9to10
Func Upgradeto10()
ProgressOn("Progress Meter", "Installation In Progress, Please Wait", "0 percent")
Run("msiexec /i 10_0.msi")
For $i = 1 to 80 step 1
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
EndFunc;==>Upgradeto10

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.