Jump to content

How to click button when appear?


kali999
 Share

Recommended Posts

Hi guys i'm studying this great program and it's code but i can't do something. I want to click or send space when button with text:Skip will appear, i wan't a loop that will be checking on for 10 sec is button skip does exist. I've made this code but it's doesn't work ;S

HotKeySet( "{F3}", "exitthescript")
WinActivate ( "[TITLE:Recovery Manager]", "")
Local $text = ControlGetText("[TITLE:Recovery Manager]", "","[CLASS:Button; TEXT:Skip; INSTANCE:3]")
While @error="1"
  $text = ControlGetText("[TITLE:Recovery Manager]", "","[CLASS:Button; TEXT:Skip; INSTANCE:3]")
  Sleep(60000)
WEnd
Sleep(3000)
Send("{SPACE}")
Func exitthescript()
     Exit
EndFunc

I hope you cant help with that. :)

Link to comment
Share on other sites

Hi,

Try this :

HotKeySet("{F3}", "_Exit")
WinActivate("[TITLE:Recovery Manager]", "")

Local $text

While 1
    $text = ControlGetText("[TITLE:Recovery Manager]", "", "[CLASS:Button;INSTANCE:3]")
    If $text = "SKIP" Then ExitLoop
    Sleep(10000) ;check every 10sec
WEnd

Send("{SPACE}")

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Br, FireFox.

Link to comment
Share on other sites

I like to validate that a control exists, isvisible, and enabled, prior to clicking, or performing an action...just create a UDF that loops until those conditions are met..sometimes, the controls may take a bit to enable, which will cause issues in your script

ControlCommand ( $hwndCallersWindow, "", $hwndCallersControl, "IsEnabled", "" )

ControlCommand ( $hwndCallersWindow, "", $hwndCallersControl, "IsVisible", "")

i do the same kind of checks on windows as well, but using wingetstate()

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

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
 Share

  • Recently Browsing   0 members

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