Sign in to follow this  
Followers 0
kali999

How to click button when appear?

3 posts in this topic

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. :)

Share this post


Link to post
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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0