EricL Posted January 29, 2008 Share Posted January 29, 2008 I am trying to do my 3rd automated installation. The first window is killing me. its a install wizard with a next button. the button reads Button3 (hidden) I put: WinWaitActive($pHandle) ; ##Start Install ControlClick($pHandle,"","Button3") It must be clicking it because I get an error in its place "error executing the specified Program" is the title with "setup.exe" in the main error window with an ok button. if i manually click the button it works. So strange. Any help would be great. Link to comment Share on other sites More sharing options...
EricL Posted January 29, 2008 Author Share Posted January 29, 2008 Is this a real stumper?? or do i need more information? Please advise if there is anything I can add to make this answerable. Thanks! Link to comment Share on other sites More sharing options...
Swift Posted January 29, 2008 Share Posted January 29, 2008 Really The helpfile does alot...(I just say this...so that so for some people it might help)More information would be nice...a screenshot of what your doing etc... Link to comment Share on other sites More sharing options...
MHz Posted January 30, 2008 Share Posted January 30, 2008 I am trying to do my 3rd automated installation. The first window is killing me. its a install wizard with a next button. the button reads Button3 (hidden)Perhaps you have a hidden button on top of the button you want to click. Using AutoItMacrogenerator within full Scite installation or even "Classes by Text" by LxP may show the control needed. If the correct control is hidden then you may need other methods to work around unless you can unhide it some how. I put: WinWaitActive($pHandle) ; ##Start Install ControlClick($pHandle,"","Button3") It must be clicking it because I get an error in its place "error executing the specified Program" is the title with "setup.exe" in the main error window with an ok button.You may also be clicking the wrong button and getting the error? Consider using WinWait for Control* functions as inactive windows are fine unless you want to use Send or Mouse* functions. if i manually click the button it works. So strange. Any help would be great.Try using the controls text as a parameter rather then the ClassNameNN and see if that works. Link to comment Share on other sites More sharing options...
EricL Posted January 31, 2008 Author Share Posted January 31, 2008 Here is what it says. I dont know how to copy the text out because as soon as i change to the info program the button is not selected.. so i made a picture. *see attached* Link to comment Share on other sites More sharing options...
EricL Posted January 31, 2008 Author Share Posted January 31, 2008 Here is my full code for the portion that involves the first click.... dont know if the rest of the clicks work as I cant get that far. ;InStall SP1 If Not IsAdmin() Then RunAsSet('administrator', @Computername, 'xxxxxxxx') run("\\network path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") Else run("\\network path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") EndIf ; RunAsSet() ; Change into the WinTitleMatchMode that supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) WinActivate("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard") WinWaitActive("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard") ; Get the handle of a window $phandle = WinGetHandle("classname=#32770", "Sage MAS 500 v7.05 Service Pack 1") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else Sleep(20) EndIf $sText = WinGetText($pHandle) sleep(300) WinWaitActive($pHandle) ; ##Start Install ControlClick($pHandle,"","Button3") MsgBox(64,"","button3 clicked") ; WinActivate("Sage MAS 500 v7.05 Service Pack 1") WinWaitActive("Sage MAS 500 v7.05 Service Pack 1") Link to comment Share on other sites More sharing options...
MHz Posted January 31, 2008 Share Posted January 31, 2008 (edited) FYI, you can use Ctrl + Alt + F to freeze the display of AutoIt Info Tool. Looking at your supplied picture, thankyou, is the "Button3" is shown as hidden but see that the text of the control is "Finish". Yep, that is not the control that you are interested in, correct? Now, as I mentioned before, is to use the text of the control that you are interested in which is "&Next >". I have made some changes so try it for yourself ;InStall SP1 If Not IsAdmin() Then RunAsSet('administrator', @ComputerName, 'xxxxxxxx') Run("\\network path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") Else Run("\\network path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") EndIf ; RunAsSet() ; Change into the WinTitleMatchMode that supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) WinWait("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard"); Added a wait WinActivate("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard") WinWaitActive("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard") ; Get the handle of a window $phandle = WinGetHandle("classname=#32770", "Sage MAS 500 v7.05 Service Pack 1") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else Sleep(20) EndIf $sText = WinGetText($phandle) Sleep(300) WinWaitActive($phandle) ; ##Start Install ControlClick($phandle, "", "&Next >"); Using text of control here MsgBox(64, "", '"&Next >" clicked') ; WinWait("Sage MAS 500 v7.05 Service Pack 1"); Added a wait WinActivate("Sage MAS 500 v7.05 Service Pack 1") WinWaitActive("Sage MAS 500 v7.05 Service Pack 1") Edit: Note that you do not need active windows when using Control* functions so a WinWait() is enough to use. If you use Send() or Mouse* functions then you may need to WinWait() for the window to arrive, WinActivate() to force activation if needed and WinWaitActive() to proceed when the window is active. You can correct the script as needed for those yourself. Edited January 31, 2008 by MHz Link to comment Share on other sites More sharing options...
EricL Posted January 31, 2008 Author Share Posted January 31, 2008 That worked like money. so the window spy tool can obviously be wrong sometimes? Im trying to finish the script now... ok. finish is not working. This is what the info window displays now. 1) it just says finish not &Finish > does that mean i cant use text now? using ControlClick($p2Handle, "", "Finish") did not work. --------- >>>> Window <<<< Title: Sage MAS 500 v7.05 Service Pack 1 Class: #32770 Position: 588, 332 Size: 504, 386 Style: 0x94C000C4 ExStyle: 0x00010101 Handle: 0x09521B42 >>>> Control <<<< Class: Button Instance: 4 ClassnameNN: Button4 ID: 1 Text: Finish Position: 323, 319 Size: 75, 23 ControlClick Coords: 52, 3 Style: 0x50010001 ExStyle: 0x00000004 Handle: 0x08AB1BE2 >>>> Mouse <<<< Position: 966, 683 Cursor ID: 2 Color: 0xE0DFE3 >>>> StatusBar <<<< >>>> Visible Text <<<< Click Finish to complete Setup. < &Back Finish Cancel Setup is complete. You may run Sage MAS 500 Client from the Start Menu. Setup Complete >>>> Hidden Text <<<< Yes, I want to view the Read Me file. Yes, I want to launch %p now. -------------- Link to comment Share on other sites More sharing options...
EricL Posted January 31, 2008 Author Share Posted January 31, 2008 Current complete code: expandcollapse popup;InStall SP1 If Not IsAdmin() Then RunAsSet('administrator', @Computername, 'xxxxxxxxx') run("\\net path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") Else run("\\net path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") EndIf ; RunAsSet() ; Change into the WinTitleMatchMode that supports classnames and handles AutoItSetOption("WinTitleMatchMode", 4) WinWait("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard"); Added a wait -MHz WinActivate("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard") WinWaitActive("Sage MAS 500 v7.05 Service Pack 1 - InstallShield Wizard") ; Get the handle of a window $phandle = WinGetHandle("classname=#32770", "Sage MAS 500 v7.05 Service Pack 1") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else Sleep(20) EndIf $sText = WinGetText($pHandle) sleep(300) WinWaitActive($pHandle) ; ##Start Install ControlClick($phandle, "", "&Next >"); Using text of control here -MHz ; ##GET Window Handle ID sleep(7000) WinWait("Sage MAS 500 v7.05 Service Pack 1"); Added a wait -MHz WinActivate("Sage MAS 500 v7.05 Service Pack 1") WinWaitActive("Sage MAS 500 v7.05 Service Pack 1") $p2handle = WinGetHandle("classname=#32770", "Sage MAS 500 v7.05 Service Pack 1") $s2Text = WinGetText($p2Handle) ControlClick($p2Handle,"", "&Next >") While Not StringInStr($s2Text, "Setup is complete.") WinActivate($p2Handle) $s2Text = WinGetText($p2Handle);get current text Sleep(20) WEnd ControlClick($p2Handle, "", "Finish") ; $endloop = 1 While $endloop = 1 $answer = ProcessWaitClose("705ServicePack1C.exe", 300000) If $answer = 0 Then $endloop = 1 Else $endloop = 0 EndIf WEnd MsgBox(64, "Updated", "MAS500 7.05 SP1 Install Complete.") Link to comment Share on other sites More sharing options...
MHz Posted January 31, 2008 Share Posted January 31, 2008 Current complete code:Do you need to get the handles and the text from the windows to complete the installation. Also the loops looks over complicated for the result that you may need. I trimmed off some bulk ;InStall SP1 If Not IsAdmin() Then RunAsSet('administrator', @Computername, 'xxxxxxxxx') EndIf $pid = run("\\net path\MAS 500 V7.05 Updates\SP1\705ServicePack1C.exe") ; RunAsSet() ; Change into the WinTitleMatchMode that supports classnames and handles Opt("WinTitleMatchMode", 4); Not sure if need this opt now -MHz $title = "Sage MAS 500 v7.05 Service Pack 1" ; WinWait($title); Added a wait -MHz ControlClick($title, "", "&Next >"); Using text of control here -MHz ; sleep(7000); Need this? -MHz ; WinWait($title); Added a wait -MHz ControlClick($title,"", "&Next >") ; WinWait($title, "Setup is complete.") ControlClick($title, "Setup is complete.", "Finish") ; ProcessWaitClose($pid, 300000); hmm, about 83 hours? -MHz ; MsgBox(64, "Updated", "MAS500 7.05 SP1 Install Complete.") Perhaps this installation is a repetition of WinWait() and ControlClick() functions for window handling? If so then make use of the text parameters of WinWait() and ControlClick() to add reliability in the automation. Note extra comments I may have added to the script. Link to comment Share on other sites More sharing options...
EricL Posted January 31, 2008 Author Share Posted January 31, 2008 Do you need to get the handles and the text from the windows to complete the installation. Also the loops looks over complicated for the result that you may need.I trimmed off some bulkOpt("WinTitleMatchMode", 4); Not sure if need this opt now -MHz>>agreed sleep(7000); Need this? -MHz>>I think so. the first click starts a status bar, then jumps to the full screen setup screen, then eventually the 3rd window to show is the one with the "next" button. HOwever it has the same classname as the first windowProcessWaitClose($pid, 300000); hmm, about 83 hours? -MHz>> LOL)#($#)($@!!!!!! oups!;Perhaps this installation is a repetition of WinWait() and ControlClick() functions for window handling? If so then make use of the text parameters of WinWait() and ControlClick() to add reliability in the automation. Note extra comments I may have added to the script.THanks~! main problem now is the "finish" window which i pasted the window info for. Once i get a control click to work on finish button ill go through and use these suggestions to trim the fat. When stuff dont work I tend to just pile more junk on :| Guess I should work for HP, (who else can put 8 items in add/remove programs for a fkn printer driver!) It works up to the finish window so im goint to leave as is until its all working.Thanks for all your help. Link to comment Share on other sites More sharing options...
EricL Posted February 1, 2008 Author Share Posted February 1, 2008 Figured it out. !!! first of all check out my attached image. I had 2 window spy versions. old one was wrong which is what I been using :| I was able to use the button4 control click to finish this script. 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