Jump to content
Sign in to follow this  
Erik.

Control get text does not work

Recommended Posts

Erik.

HI all,

I am trying to get text from a button.

I can click the button so my class name is right.

Here is some information about the button:

>>>> Window <<<<
Title:  Statics Control
Class:  TStaticsControlForm
Position:   862, 198
Size:   378, 488
Style:  0x16CC0000
ExStyle:    0x00010100
Handle: 0x00000000001606E0

>>>> Control <<<<
Class:  TStaticButton
Instance:   20
ClassnameNN:    TStaticButton20
Name:   
Advanced (Class):   [CLASS:TStaticButton; INSTANCE:20]
ID: 395060
Text:   
Position:   2, 2
Size:   140, 20
ControlClick Coords:    95, 15
Style:  0x54000000
ExStyle:    0x00000000
Handle: 0x0000000000060734

>>>> Mouse <<<<
Position:   967, 265
Cursor ID:  0
Color:  0xF0F0F0

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<

The button has the name 01 strobe int.

I can use some commands like is visible but i can't use add string ischecked etc.

Check and uncheck works great.

Is there a way to get the text of my button?

This is my line i am using:

$check = ControlGetText("Statics Control","","[CLASS:TStaticButton; INSTANCE:20]")

I also would like to use the ischecked function to see if the button is checked but that does not work, is there also a solution for?

Hope you can help me :mellow:

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
wakillon

I also would like to use the ischecked function to see if the button is checked but that does not work, is there also a solution for?

GUICtrlRead ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
Erik.

Indeed it says it has no text but it has, that the strange thing.

Will GUICtrlRead work when it's an eternal program that has not been made with autoit?


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
wakillon

No.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
GEOSoft

The control information looks very much like the app is written in Delphi and Delphi controls can be difficult to work with using normal automation methods.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Erik.

mmm okay,

Is there any solution for this or is it impossible ?


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
Erik.

What is the solution?

Edit:

I have found an example plugin program for the main program and it is programmed in Delphi.

The plugin program can control the main program and uses the function Sendmessage.

Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
wakillon

What is the solution?

Try ControlCommand with IsChecked command option.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
Erik.

Tried that option, it does not matter if the button has been pressed or not i always get a 0 back.

Tried this:

$check = ControlCommand("[CLASS:TStaticsControlForm]","","[CLASS:TStaticButton; INSTANCE:20]","IsChecked","")
Edited by Erik.

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
JohnOne

I had limited success automating cheat engine once, and I think that is delphi.

try

#Include <GuiButton.au3>

$button = ControlGetHandle("Statics Control","","[CLASS:TStaticButton; INSTANCE:20]");

$buttontext = _GUICtrlButton_GetText($button)

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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
JohnOne

And if I remember correctly the controls needed focus

#Include <GuiButton.au3>

$button = ControlGetHandle("Statics Control","","[CLASS:TStaticButton; INSTANCE:20]");
ControlFocus("Statics Control","",$button)
$buttontext = _GUICtrlButton_GetText($button)

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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Erik.

I will try that in a minute :mellow:

That is the button i want to read the text and if it has been pressed.


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
Erik.

Button text is empty :mellow:

Does not work.


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
Erik.

Start at the beginning.

Does this work?

WinActivate("[CLASS:TStaticsControlForm]")

Yes that works fine.

I can also check the button with controlcommand, i can not uncheck the button.


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites
Erik.

The state is always 0.

There is another way to see if the button is activated.

The button will color green if it's activated.

Only problem then is, you can only see if the button is programmed by the text at the button.


I little problem, hard to find and fix

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  

×