GetControlText not returning any value
Moderators: Dorian (MJT support), JRL
GetControlText not returning any value
Hello,
I am having problems with the GetControlText command. I cant get it return any value. It should return the text it reads or ##NOSUCHWINDOW## or ##NOSUCHOBJECT##. However, when I run the code below or try to write the results to file it just prints the string "Value" and not the actual value.
GetControlText>Kyocera Tools,TEdit,1,Value
Message>Value
Any help would be appreciated.
Thanks
I am having problems with the GetControlText command. I cant get it return any value. It should return the text it reads or ##NOSUCHWINDOW## or ##NOSUCHOBJECT##. However, when I run the code below or try to write the results to file it just prints the string "Value" and not the actual value.
GetControlText>Kyocera Tools,TEdit,1,Value
Message>Value
Any help would be appreciated.
Thanks
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Just a thought on why this might have happened. Did you use "View System Windows" to look for "Kyocera tools"? If so you created a Tedit window as I reported in this post. You would therefore have two Tedit windows named "Kyocera tools" with one of them, having been created by the View System Windows search, having no text to capture. If that one was the #1 instance of the window, you would get no result even though you found a valid window. Reseting your computer would eliminate the one in View System Windows.
Are you sure the title of the window you are trying to get that from is "Kyocera Tools" and not "Kyocera Tools_" (extra space at the end) or something like that? I've seen apps that do that and you can't really tell there's a space there, unless you examine the title text using something like the "View System Windows" utility available from the Macro Scheduler Main window, Tools menu.dynz wrote:I found the following code works, but I cant explain why.
GetControlText>Kyocera*,TEdit,1,Value
Message>Value
The Kyocera Tools is the only window so the code above should work. Any ideas/comments etc would be appreciated
Thanks
Another possibility is... there may be another window with the name "Kyocera Tools" used by the app and it may be completely invisible to the user. I've seen that too. An app might even use the exact same title for both a visible and an invisible window... makes things a little tricky when you are trying to zero in on the window you want to manipulate but there are ways.
You may be able to use the FindWindowWithText> command. To quote directly from the helpful Help File... "This function is useful when an application has two windows with the same name, and allows the correct one to be located and focused." If this method works, you can also use it to find the window's handle which is completely unique and you can then use the handle (instead of the title) in the GetControlText> command and know that you have targeted the correct window.
Hope this was helpful, welcome to the forums and take care.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
I didn't see JRL's post until after I had posted... that does sound like the problem alright and could be proven fairly easily. Nice find JRL... I wonder how much head scratching that scenario has caused over the years. Thanks for sharing that.JRL wrote:Just a thought on why this might have happened. Did you use "View System Windows" to look for "Kyocera tools"? If so you created a Tedit window as I reported in this post. You would therefore have two Tedit windows named "Kyocera tools" with one of them, having been created by the View System Windows search, having no text to capture. If that one was the #1 instance of the window, you would get no result even though you found a valid window. Reseting your computer would eliminate the one in View System Windows.
Take care
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Re: GetControlText not returning any value
One thing I've discovered today is that the TEdit control class will only release it's text value if it is not currently greyed out. If it's white it will allow you to retrieve it.