Jump to content

Recommended Posts

Posted (edited)

Still attempting to automate program installation, ran into another problem.

Currently, I am unable to get ControlClick to work. There must be something I am doing wrong here and I would like to have some advice on how to go about making the button click.

Here is the current code I have.

Run(@ScriptDir & "7-Zip 9.2.exe")
 
Local $7Zip = WinWaitActive ("7-Zip 9.20 Setup ","")
 
MsgBox ( $MB_OK, "Testing", "Going to click Install")
 
;ControlClick("7-Zip 9.20 Setup ", "", "[CLASS:Button; TEXT:&Install; INSTANCE:2]")
ControlClick( $7Zip, "", "[CLASS:Button; TEXT:&Install; INSTANCE:2]")
 
MsgBox ( $MB_OK, "Testing", "Hello")
 
When I run the code, it just skips over ControlClick without clicking anything.
Edited by Suppish
Posted

Wait what?

That worked. But I am confused.

Sure there was only a single instance of &Install, but according to the AutoIt Window Info thingy it said the install button was Instance 2...

Posted (edited)

Those identifications are generally mutually exclusive.

It's the second instance of a button, but it's the first instance of a button with that specific text.

Also, I'd recommend the use of the ID, instead...assuming the install is id=4:

ControlClick( $7Zip, "", 4)

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted (edited)

Why are you trying to automate the GUI for installation?  There is an MSI installer available that you can use to do a silent installation.  

msiexec.exe /i "7z920.msi" ALLUSERS=1 /qn /norestart /log output.log

Adam

Edited by AdamUL
Posted

Nah, it's only smart, if you know about it.  When working with software installations, look for silent command line options first.  Use automating the GUI as a very last resort.  

 

Adam

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...