Sign in to follow this  
Followers 0
ileandros

ControlGetText()

5 posts in this topic

Hello there,

I am using command CotrolGetText() to get the text in a window that exists in my pc.

Let me show you first the code:

if WinExists("test") Then
Local $sText = ControlGetText("[CLASS:QWidget]", "", "QWidget75")
MsgBox(0, "ControlGetText Example", "The control text is: " & $sText)
EndIf

Autoit info tools summary:

>>>> Window <<<<
Title: test
Class: QWidget
Position: 2, 26
Size: 816, 638
Style: 0x16CF0000
ExStyle: 0x00000100
Handle: 0x002701C0

>>>> Control <<<<
Class: QWidget
Instance: 75
ClassnameNN: QWidget75
Name:
Advanced (Class): [CLASS:QWidget; INSTANCE:75]
ID:
Text:
Position: 398, 115
Size: 18, 451
ControlClick Coords: 8, 183
Style: 0x56000000
ExStyle: 0x00000000
Handle: 0x00150506

>>>> Mouse <<<<
Position: 416, 354
Cursor ID: 0
Color: 0xFDF3D4

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
buttonChannels
buttonServers
buttonFriends
buttonEditProfile
buttonEditAccount
buttonSettings
buttonHelp
tabView
lstChannels
qt_scrollarea_viewport
containerwidget
buttonLibrary
lblButtonEditAccount
lblButtonServers
lblButtonChannels
lblButtonFriends
logo
lblButtonHelp
lblButtonEditProfile
lblButtonSettings
tabChannels
qt_tabwidget_tabbar
qt_tabwidget_stackedwidget
containerwidget
cmdSign
Modes
lstSigned
qt_scrollarea_viewport
qt_scrollarea_viewportq
t_scrollarea_viewport
gSigned
gOpen
gOutline
Chat
lstUsers
qt_scrollarea_viewport
containerwidget
txtChat
qt_scrollarea_vcontainer
qt_scrollarea_viewport
txtChatInput
containerwidget
centralWidget

>>>> Hidden Text <<<<
qt_scrollarea_vcontainer
qt_scrollarea_hcontainer
lblButtonLibrary
qt_scrollarea_vcontainer
qt_scrollarea_hcontainer
qt_scrollarea_vcontainer
qt_scrollarea_hcontainer
qt_scrollarea_vcontainer
qt_scrollarea_hcontainer
qt_scrollarea_vcontainer
qt_scrollarea_hcontainer

The autoit info tool is clicked on the text field.

It is a text field that displays the messages i recive but it is not editable.

Is there a way to get the messages that are displayed in it and show them with a msgbox??

I want to do this so i can give some commands to avoid some spam messages i receive and close the window.


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites



Bump. Someone???


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

Have you tried using the title of the window in controlgettext instead of its class name? Have you tried having the app write that text to a text file itself? It looks like something you threw together yourself judging by the title of it.

Seeing as how we have no idea what app you're trying to read from, it will be extremely difficult to help troublshoot the problem other than suggesting the obvious ways of doing it. One way would be to have your script find the PID of the program and use that in place of the title, or even its windows handle.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Yes i have tried everything. I just added test there because there was no reason adding the the real name because its a personal thing that is hard for someone to know it.

I just wanted to know how it should be placed because as it normaly should be placed, it doesnt work.

I am trying similar script to another programm and it works. Here it doesnt. I posted the autoit info tool so if somone could understand and tell me.

Although i have tried most of the combinations...


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

This is the working code that should normaly work. I asked the database service and they gave me the names of it.

if WinExists("Client (4.3.2)") Then
Local $stext = ControlGetText("Client (4.3.2)","","QTextEdit")
MsgBox(0,"tittle","hello i am ur staff:"&$stext)
EndIf

Any ideas why it doesnt work??????


I feel nothing.It feels great.

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