Sign in to follow this  
Followers 0
kali999

ControlClick button by text ?

7 posts in this topic

Hi,

I'm confused, i want to click button by the text, but my button have very long name "Verify the system structure and fix problems" how can i use controlclick too hit it ? i have code :

While 1
$next = ControlClick("[TITLE:Recovery Manager]", "", "[CLASS:Button; INSTANCE:10]")
If $next = "Verify the system structure and fix problems" Then ExitLoop
Sleep(4000)
WEnd

But it doesn't work :( Is there any possibility to use shorter text like "Verify~" ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

use Autoit Window Info Tool to get the Control Id of the Button

and then use it for controlclick

Edit: BTW the function returns a boolean value [not the value of the button]

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Yeah i know that i can use ID's but i would like to operate on TEXT, another problem is that when i use more than one While loop script works only for first one, when it going to ::next button it doesn't recognize or just freezing i don't know :(, any ideas? I just want to my script recognize text in buttons and go to the next position which is almost the same.

::yes Button
While 1
$text = ControlClick("[TITLE:testing app]", "", "[CLASS:Button; INSTANCE:4]")
If $text = "No" Then ExitLoop
Sleep(2000)
Wend
ControlClick("[TITLE:testing app]", "", "[CLASS:Button; INSTANCE:4]", "left")
Sleep(2000)

::Next Button
While 1
$text = ControlClick("[TITLE:testing app]", "", "[CLASS:Button; INSTANCE:6]")
If $text = "Next" Then ExitLoop
Sleep(2000)
Wend
ControlClick("[TITLE:testing app]", "", "[CLASS:Button; INSTANCE:6]", "left")
Sleep(2000)

Share this post


Link to post
Share on other sites

kali999,

Is there any possibility to use shorter text

Try using Opt("WinTitleMatchMode", 2). I know it works for window titles - so I imagine it might work for other controls as well. Please let us know how you get on. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

from what I understand ControlClick() is the function that performs the clicking action so the only value for your $text variable would be success or failure (0 or 1)

Share this post


Link to post
Share on other sites

from what I understand ControlClick() is the function that performs the clicking action so the only value for your $text variable would be success or failure (0 or 1)

Yeah but the text compare works fine, what i see i have problem with clicking, i have tried many possibilities but it's not problem with text but with button, it's suppose to click button when it find but it clicking without any reaction, something like click the button with mouse and before releasing left button you move mouse from button area. Any clue ? I don't want to use mouseclick ;S Thanks to support :D

Share this post


Link to post
Share on other sites

kali999,

Try using Opt("WinTitleMatchMode", 2). I know it works for window titles - so I imagine it might work for other controls as well. Please let us know how you get on. :)

M23

I tried Opt but it seems doesn't work for Buttons

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