GetControlText not returning any value

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
dynz
Newbie
Posts: 4
Joined: Thu Jun 21, 2007 11:52 pm

GetControlText not returning any value

Post by dynz » Fri Jun 22, 2007 12:07 am

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

dynz
Newbie
Posts: 4
Joined: Thu Jun 21, 2007 11:52 pm

Post by dynz » Fri Jun 22, 2007 12:45 am

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

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Jun 22, 2007 1:35 am

This may not work, but have you tried this?

GetControlText>Kyocera Tools*,TEdit,1,Value
Message>%Value%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

dynz
Newbie
Posts: 4
Joined: Thu Jun 21, 2007 11:52 pm

Post by dynz » Fri Jun 22, 2007 1:49 am

funniest thing, I reset my computer and the code worked. Not sure if there was something running in the background that I wasnt aware of.

dynz
Newbie
Posts: 4
Joined: Thu Jun 21, 2007 11:52 pm

Post by dynz » Fri Jun 22, 2007 1:51 am

Thanks for replying

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jun 22, 2007 4:14 am

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.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Jun 22, 2007 4:20 am

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

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 - :-)

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Jun 22, 2007 4:27 am

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

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 - :-)

cvlr
Newbie
Posts: 18
Joined: Thu Jun 07, 2018 4:40 pm

Re: GetControlText not returning any value

Post by cvlr » Fri Sep 21, 2018 7:43 pm

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.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts