Jump to content

read text from control


Recommended Posts

i need help to read text and display in message box.

for ex: multiplication using calculator and read the output and show in message box. Pls help how to read the text displayed in calculator edit box

Link to comment
Share on other sites

  • Moderators

Ratna,

Welcome to the AutoIt forum. :mellow:

You need to use the ControlGetText command, after having used the Au3 Window Info tool to identify the edit control in Calulator.

This script shows how it works:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton = GUICtrlCreateButton("Read", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            If Not WinExists("Calculator") Then
                MsgBox(0, "Error", "Please Start Calculator")
            Else
                $sContent = ControlGetText("Calculator", "", "[CLASS:Edit;INSTANCE:1]")
                MsgBox(0, "Calc Read", "Calculator is reading: " & $sContent)
            EndIf
    EndSwitch

WEnd

Start Calculator (the script reminds you if you do not!) and when you are ready to read the result, press the "Read" button.

Ask if anything is unclear. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

hornet.

What does the Window Info tool tell you about the window and the listbox control? :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Hey M23, this is what the info tool shows me. I have tried to run _GUICtrlListBox_GetText and it returns "0". I have also tried _GUICtrlListBox_FindInText and _GUICtrlListBox_FindString with no luck. I have tried various _GUICtrlListView_ functions as well. Any further help or direction is greatly appreciated.

>>>> Window <<<<

Title: Lobby

Class: #32770

Position: 112, 317

Size: 825, 608

Style: 0x94CF0004

ExStyle: 0x00010100

Handle: 0x01020550

>>>> Control <<<<

Class: ListClass

Instance: 1

ClassnameNN: ListClass1

Name:

Advanced (Class): [CLASS:ListClass; INSTANCE:1]

ID:

Text:

Position: 9, 201

Size: 554, 227

ControlClick Coords: 269, 70

Style: 0x54210000

ExStyle: 0x00000000

Handle: 0x01E70520

>>>> Mouse <<<<

Position: 394, 638

Cursor ID: 0

Color: 0xF7F7F7

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Link to comment
Share on other sites

  • Moderators

hornet,

This "Lobby" window would not be the lobby in Zynga poker, which your friend Phenom has been trying to read and been warned off here, would it? :mellow:

I would hate to think you were trying to get round the ban on getting help to break an EULA. Do you want a holiday from here that much? :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Number 1, I have never spoke to Phenom before seeing his post...it just appears that he and I are looking for the same type of information. Number 2, just because it's a "Lobby" does not mean it's a poker lobby. And besides that, just like Phenom said in his post Zynga is not for real money, they don't consider bots cheating, and if I wanted a Zynga bot I would just download the one that is already available. So I would really like to find the information I am looking for just as Phenom probably is as well. Is this something that is too complicated for the massive volume of users in this forum?

-hornet

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