MSFN Forum: AutoIT Evaluate Conditions - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

AutoIT Evaluate Conditions Rate Topic: -----

#1 User is offline   danr29 

  • Group: Members
  • Posts: 7
  • Joined: 17-November 05

Posted 06 July 2006 - 12: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


#2 User is offline   redfive19 

  • Junior
  • Pip
  • Group: Members
  • Posts: 96
  • Joined: 17-August 04

Posted 06 July 2006 - 12:27 PM

View Postdanr29, on Jul 6 2006, 01:03 PM, said:

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.

$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

#3 User is offline   danr29 

  • Group: Members
  • Posts: 7
  • Joined: 17-November 05

Posted 06 July 2006 - 01:11 PM

Thank you Redfive, that works great! Would you actually know the correct syntax for the ControlClick function? I really appreciate the help.

-Dan

#4 User is offline   redfive19 

  • Junior
  • Pip
  • Group: Members
  • Posts: 96
  • Joined: 17-August 04

Posted 06 July 2006 - 01:25 PM

Glad to hear! I love it when a plan comes together.

As far as the ControlClick() goes, your best bet is to read the AutoIt help file. Basically it "clicks" a button for you instead of you sending enter. For instance:

ControlClick('Reconfiguration Confirmation', '', 'Button1')


Where 'Reconfiguration Confirmation' is the title of the window, '' is any text in the window and 'Button1' is the name of the button you want to click.

You get the info the same way you got the title of that window - with the AutoIt Window Info tool. Hover over the 'OK' button or whatever button ENTER clicks. It should tell you what button name it is.

#5 User is offline   danr29 

  • Group: Members
  • Posts: 7
  • Joined: 17-November 05

Posted 06 July 2006 - 01:49 PM

Yeah the ControlClick function is a little tricker. I've found some examples online but there all inconsistant w/ each other. But I should be able to figure it out. Thanks a lot.

#6 User is offline   redfive19 

  • Junior
  • Pip
  • Group: Members
  • Posts: 96
  • Joined: 17-August 04

Posted 06 July 2006 - 02:01 PM

if you send me the AutoIt window info text, I can send you the code. In fact, I am almost positive that the code I just posted might just work if there's only one button!

Give it a try. Replace the

Send('{ENTER}')


with

ControlClick('Reconfiguration Confirmation', '', 'Button1')


#7 User is offline   danr29 

  • Group: Members
  • Posts: 7
  • Joined: 17-November 05

Posted 07 July 2006 - 07:33 AM

OK cool I got it to work. I just replaced the 'button1' statement with 'Yes' (the name of the button to click on) and it worked great. Again thanks for the help.

-Dan

#8 User is offline   redfive19 

  • Junior
  • Pip
  • Group: Members
  • Posts: 96
  • Joined: 17-August 04

Posted 07 July 2006 - 08:46 AM

np, I just realzied you also will DEF want to change

WinWaitActive


to

WinWait


Otherwise, if that window's not active, the script will halt till it is.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy