Jump to content
Sign in to follow this  
nasim007

Reading a label

Recommended Posts

nasim007

Hello Everyone,

I have downloaded and read the PDF document for AutoIT beginners "Learning to Script with AutoIT V3". I want to express my sincerest gratitude for that well structured peice of information. It has set good ground work for me as a newbie. Here is a question:

I want to make a message box pop up when a specific label changes within another window. I used the Window info utility and have obtained all the necessary information. But I do not know how to use it in the script.

Here is some of the Window information:

Class: WindowsForms10.STATIC.app.0.33c0d9d5

Instance: 5

ID: 1903750

Text: Click on Burn to start burning.

The text mentioned above will change to "Burning started..." when the user starts to burn. This is when I want a message box to pop-up within my script. Any ideas?

Share this post


Link to post
Share on other sites
martin

Hello Everyone,

I have downloaded and read the PDF document for AutoIT beginners "Learning to Script with AutoIT V3". I want to express my sincerest gratitude for that well structured peice of information. It has set good ground work for me as a newbie. Here is a question:

I want to make a message box pop up when a specific label changes within another window. I used the Window info utility and have obtained all the necessary information. But I do not know how to use it in the script.

Here is some of the Window information:

Class: WindowsForms10.STATIC.app.0.33c0d9d5

Instance: 5

ID: 1903750

Text: Click on Burn to start burning.

The text mentioned above will change to "Burning started..." when the user starts to burn. This is when I want a message box to pop-up within my script. Any ideas?

I would try

ControlGetText

which uses the window title, text (just use "" for the text), and the control ID.

The problem might be that the control ID is not always the same.

EDIT: Oh, first post- Welcome to the AUtoIt forums nasim007 :D

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Bowmore

As this is a .Net control you will probably find that ClassNN, Instance and ID are different every time the application runs. One way to get around this is to grab the handle of the control using the initial Text as the identifier. and then use the handle to check if the text has changed. 

#Include <WinAPI.au3>

; Put this near the start of your script when the control is first visible
$hwnd = ControlGetHandle("WidowTile","","[TEXT:Click on Burn to start burning.]")



; Put this were you need to check if the text has changed
If _WinAPI_GetWindowText($hWnd) = "Burning started..." Then
    MsgBox(0,"Message", "Burning started...")
EndIf

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
nasim007

As this is a .Net control you will probably find that ClassNN, Instance and ID are different every time the application runs. One way to get around this is to grab the handle of the control using the initial Text as the identifier. and then use the handle to check if the text has changed. 

#Include <WinAPI.au3>

; Put this near the start of your script when the control is first visible
$hwnd = ControlGetHandle("WidowTile","","[TEXT:Click on Burn to start burning.]")



; Put this were you need to check if the text has changed
If _WinAPI_GetWindowText($hWnd) = "Burning started..." Then
    MsgBox(0,"Message", "Burning started...")
EndIf

Thanks a lot guys. However, this now raises another question. Down the road I know I will have to deal with the ControlID. I cannot seem to find a command that retrieves the control's ID. As per Bowmore's coding suggestion, that works because we can deal with "TEXT: Insert text here" as an identifier to retrieve the handle. But what if the control does not contain text? I will keep tinkering but the deadline is fast approaching. Any help is strongly appreciated. Edited by nasim007

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  

×