QUOTE (danr29 @ Jul 6 2006, 01:03 PM)

Hello! I have created an AutoIT script to upgrade a file for 2 different versions of an application but I am having an issue evaluating a 3rd condition. The following is the script I have put together:
; Script Function:
; Performs configuration upgrade to either Integrity Agent 5 or Integrity Agent 6
;
$IA6PATH = "c:\Program Files\checkpoint\integrity client\iclient.exe"
$IA5PATH = "c:\Program Files\zone labs\Integrity Client\iclient.exe"
$GO1 = '"C:\Program Files\Zone Labs\Integrity Client\iclient.exe" -config "\\(machinename)\C$\temp\reconfig\ServerIP.xml"'
$GO2 = '"C:\Program Files\checkpoint\Integrity Client\iclient.exe" -config "\\(machinename)\C$\temp\reconfig\ServerIP.xml"'
;
If $IA5PATH = 1
Then
Run($IA5)
Else
Run($IA6)
Endif
;
WinWaitActive("Reconfiguration Confirmation")
Send("{ENTER}")
I need to enter in a 3rd condition that will exit if the script cannot find either of the directories ($IA5 or $IA6). I've tried using Elseif, separate If...Then, Select Case statements and subroutines but none have worked. If someone can just explain the proper way to evaluate multiple conditions in AutoIT I can have this script finally working the right way. Thank you.
-Dan
try this. I don't know if both could ever exist together but who knows. I don't know your environment.
CODE
$IA6PATH = FileExists(@ProgramFilesDir & '\checkpoint\integrity client\iclient.exe')
$IA5PATH = FileExists(@ProgramFilesDir & '\zone labs\Integrity Client\iclient.exe')
If $IA5PATH = 1 and $IA6PATH = 0 Then
FileChangeDir(@ProgramFilesDir & '\Zone Labs\Integrity Client')
Run('iclient.exe -config ' & '"\\(machinename)\C$\temp\reconfig\ServerIP.xml"')
WinWaitActive('Reconfiguration Confirmation')
Send('{ENTER}')
Elseif $IA5PATH = 0 and $IA6PATH = 1 Then
FileChangeDir(@ProgramFilesDir & '\checkpoint\integrity client')
Run('iclient.exe -config ' & '"\\(machinename)\C$\temp\reconfig\ServerIP.xml"')
WinWaitActive('Reconfiguration Confirmation')
Send('{ENTER}')
Elseif $IA5PATH = 0 and $IA6PATH = 0 Then
Msgbox(0, 'None found', 'Neither was found.')
endif
That should work. I would personally use ControlClick() instead of that Send('{ENTER}'). That's risky if that window is not in focus. I like the FileChangeDir() command in there because I feel it's better to run arguments that way but it's just a matter of preference. You could also have AutoIt check the version of the iclient.exe if you wanted but that may be out of the scope of your needs.
Tell me if that works.
-Redfive