Jump to content

GET TEXT FROM A BUTTON


isma08
 Share

Recommended Posts

  • Moderators

Hi, isma08, welcome to the forum. This works just fine for me, why the nested WinGetTitle when you have the Class already?

$text = ControlGetText("[CLASS:CalcFrame]", "", "Button14")
MsgBox(0, "", $text)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

that's the problem, the info-tool does not show me the text, but not if there is any way in programming.

 

>>>> Window <<<<
Title:  Calculadora
Class:  CalcFrame
Position:   1772, 234
Size:   228, 322
Style:  0x14CA0000
ExStyle:    0x00000100
Handle: 0x00060700

>>>> Control <<<<
Class:  Button
Instance:   14
ClassnameNN:    Button14
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:14]
ID: 139
Text:   
Position:   89, 129
Size:   34, 27
ControlClick Coords:    18, 14
Style:  0x50000000
ExStyle:    0x00000004
Handle: 0x000207CE

>>>> Mouse <<<<
Position:   1887, 427
Cursor ID:  0
Color:  0x6A395B

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
0


>>>> Hidden Text <<<<

 

Edited by isma08
Link to comment
Share on other sites

Notice window info tool cannot even get the text.

The code is fine 

$text = ControlClick("[CLASS:CalcFrame]", "", "[CLASS:Button; INSTANCE:14]")

It's just not giving up its text, I've no idea why, except it's not a win32 standard control.

Just the way it is sometimes.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

The code below only works because the control id's for the calculator buttons end in the number corresponding to the button...   so it appears for me at least.

#include <WinAPI.au3>

$hWndButton = ControlGetHandle("[CLASS:CalcFrame]", "", "Button14")
$strButtonCtrlID = _WinAPI_GetDlgCtrlID($hWndButton)

MsgBox(0,"", StringRight($strButtonCtrlID, 1))

Most of the time ControlGetText will work as you expect, however, in this specific case the text property is blank so there is no text to get.

Hope this helps you out somehow.

Edited by MaxG
Fixed spelling and removed some speculation.
Link to comment
Share on other sites

Calc.exe ( and some other) since windows vista Draw the text. if you do not want to use IUIAutomation. You simple can create an array to check if Button instance=5 I'm over (number 1) etc...

 

Saludos

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