finalfx Posted August 20, 2008 Share Posted August 20, 2008 (edited) Hello,I'm trying to automate an AntiVIR antivirus install; however, I ran into a problem. The install title is the same on the first 3 screens and the 2nd screen is a decompression of the files. I have tried sleep, and multiple attempts at also grabbing secondary text in the install using winwaitactive to have autoit pick up which window is currently displayed so I can have it select the right button. The window after has subtext I can select so as soon as I figure out this one problem I can finish the rest. I will post my code followed by the pictures of the first 3 screens.Run("antivir_workstation_winu_en_h.exe") WinWaitActive("Avira AntiVir Personal") Controlclick("Avira AntiVir Personal", "Accept", "Button1") WinWaitActive("Next", "Welcome to the setup") Controlclick("Next", "Button2") Edited August 20, 2008 by finalfx Link to comment Share on other sites More sharing options...
iceberg Posted August 20, 2008 Share Posted August 20, 2008 _ProcessGetName ? mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
amokoura Posted August 20, 2008 Share Posted August 20, 2008 You could try to inspect the windows with AutoIt Window Info tool and try to find some distinguishable elements. Link to comment Share on other sites More sharing options...
zfisherdrums Posted August 20, 2008 Share Posted August 20, 2008 (edited) First, I see some incongruities with the example code. Try changing the last 2 lines to read: WinWaitActive("Avira AntiVir Personal", "Welcome to the setup") Controlclick("Avira AntiVir Personal", "", "Button2") Failing this, I agree with amokoura. Try using a UDF to wait for the specific control to exist. For example: ;=============================================================================== ; ; Function Name: WinWaitControlExists ; Description:: Waits for a control to exist in the active window ; Parameter(s): $controlID = Any valid AutoIt control search parameter(s) ; $timeoutMilliseconds = time to wait in milliseconds ( default is 2000 ) ; Requirement(s): None ; Return Value(s): Success = handle to the control; Failure = 0 ( @error = 1 ) ; Author(s): Zach Fisher ; ;=============================================================================== ; Func WinWaitControlExists( $controlID, $timeoutMilliseconds = 2000 ) Local $returnCode = 0 Local $time = 0 Local $sleepTime = 250 while ( $returnCode <> 1 ) AND ( $time < $timeoutMilliseconds ) $returnCode = ControlFocus( "[ACTIVE]", "", $controlID ) $time = $time + $sleepTime Sleep( $sleepTime ) wend if $returnCode = 0 then SetError( 1 ) Else $returnCode = ControlGetHandle( "[ACTIVE]", "", $controlID ) EndIf return $returnCode EndFunc Where: WinWaitActive("Avira AntiVir Personal") $control = WinWaitControlExists( "[CLASS:Button;TEXT:Accept]" ) ControlClick( "[ACTIVE]", "", $control ) Edited August 20, 2008 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
finalfx Posted August 20, 2008 Author Share Posted August 20, 2008 that should help thanks a lot guys, i'll try this tonight. Link to comment Share on other sites More sharing options...
Bert Posted August 20, 2008 Share Posted August 20, 2008 You could also see if the install file can use command line switches. If so, then the install would be easy. The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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