Suppish Posted June 6, 2014 Share Posted June 6, 2014 (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 June 6, 2014 by Suppish Link to comment Share on other sites More sharing options...
jdelaney Posted June 6, 2014 Share Posted June 6, 2014 I doubt there are two instances of a button with text=&Install ControlClick( $7Zip, "", "[CLASS:Button; TEXT:&Install]") 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. Link to comment Share on other sites More sharing options...
Suppish Posted June 6, 2014 Author Share Posted June 6, 2014 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... Link to comment Share on other sites More sharing options...
jdelaney Posted June 6, 2014 Share Posted June 6, 2014 (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 June 6, 2014 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. Link to comment Share on other sites More sharing options...
AdamUL Posted June 6, 2014 Share Posted June 6, 2014 (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 June 6, 2014 by AdamUL Link to comment Share on other sites More sharing options...
Suppish Posted June 6, 2014 Author Share Posted June 6, 2014 Aha, but you see; that would be the smart thing to do. Link to comment Share on other sites More sharing options...
AdamUL Posted June 6, 2014 Share Posted June 6, 2014 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now