Ruud Posted March 15, 2012 Posted March 15, 2012 Hey everyone!I'm stuck trying to get text from a control.The control's info: >>>> Window <<<<Title: Glot ProfessionalClass: WindowsForms10.window.8.app.0.3553390Position: -1579, 216Size: 912, 666Style: 0x16CF0000ExStyle: 0x00050100Handle: 0x001E0550>>>> Control <<<<Class: WindowsForms10.window.8.app.0.3553390Instance: 8ClassnameNN: WindowsForms10.window.8.app.0.35533908Name: EuroglotGridBaseAdvanced (Class): [NAME:EuroglotGridBase]ID: 459892Text:Position: 17, 85Size: 426, 415ControlClick Coords: 163, 266Style: 0x56010000ExStyle: 0x00010200Handle: 0x00070474First I triedControlGetText($"Glot Professional", "", "WindowsForms10.Window.8.app.0.35533908")and various variations on the control ID ("[Name:EuroglotGridBase]", etc.).The control gets found, however, no text is returned.Q1: What kind of control is this anyway? I'm thinking it's a subform, but have no idea how to interact with it.Then I tried to target the entire window withWinGetText("Glot Professional")Some text is returned, e.g. text visible in other controls (textboxes, comboboxes, command buttons, ...), but not that which is visible in the control I'm trying to get the text of.Q2: Does this automatically mean that any attempts to get the text by targeting the control directly (instead of the entire window) will fail?Q3: Any suggestions how to tackle this problem?Thank you!RuudPS - I could post a screenshot if at all helpful.
JohnOne Posted March 15, 2012 Posted March 15, 2012 ControlGetText("Glot Professional", "", "[NAME:EuroglotGridBase; INSTANCE:8]")Try that, but it's probably a non standard control. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Ruud Posted March 15, 2012 Author Posted March 15, 2012 Hey John, Thanks for your quick reply.Unfortunately that doesn't work either.Some additional information:When I look at the 'visible text' and 'hidden text' tabs of AutoIt Window Info, the text i'm looking for is not there (but all the text I get with WinGetText is).Does this mean I cannot obtain it? Thanks again
JohnOne Posted March 15, 2012 Posted March 15, 2012 "cannot" is not a word I'd use willy nilly around here.But I've seen these posts before with similar looking controls and they mostly end in failure. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Ruud Posted March 15, 2012 Author Posted March 15, 2012 The thing is I can give the control focus, and also send keystrokes that make the selection jump from word to word. I'd almost say there has to be a way to get its text directly...If worse came to worse I could of course use the sending-keystrokes-ability to copy-paste the words one by one to a location elsewhere. However this would have me loose non-selectable words/information that I need to. And I sure hope there's an easier, less error-prone way of interacting with this thing!PS - The attached screenshot shows in green (red) the controls I can (cannot) interact with / get the text from; just to get an idea what I'm dealing with.
Ruud Posted March 15, 2012 Author Posted March 15, 2012 (edited) Another thought - the control I'm trying to interact with seems to be a form in itself; it is of the same class as the form it's placed on. I'm not sure if that's helpful or usuable, but I thought I'd share my observations Edited March 15, 2012 by Ruud
JohnOne Posted March 15, 2012 Posted March 15, 2012 I'm afraid that what you can do with keyboard input does not mean anything, nor does the fact you can do one thing with one control, but not another. If it not a standard windows control, and not giving up its secrets, there is really very little you can do. Of course, someone might come along who knows otherwise. Best of luck with it . AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Ruud Posted March 16, 2012 Author Posted March 16, 2012 Alright John, thanks for your help; I didn't expect these things to be so complicated! Maybe I can try OCR... though that'll really slow things down of course, and things are already time-critical as they are. I take it that the fact the control seems to be a form/window in itself is irrelevant, then?
JohnOne Posted March 16, 2012 Posted March 16, 2012 I'm not sure what that means to be honest. It is possible that it is a child window, but the info tool would still give you the correct window name and control whether it is or not. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
WSorich Posted March 21, 2012 Posted March 21, 2012 Hi, I have a similar thread over here; I have made a couple discoveries and would be interested to see if they will help you also.Cheers.
Ruud Posted March 23, 2012 Author Posted March 23, 2012 Thanks for that tip WSorich.Currently I'm using OCR for some parts, but that's really slow and not an option if I don't want to let it run for 6 months or so before completing I'll have a look and see if I can get some more info - but I'm afraid I'm too new to autoit so that we're at the mercy of more knowledgeable people
rodent1 Posted March 23, 2012 Posted March 23, 2012 If you can't directly read the text, there may be other ways. Using the menus of the window in the screenshot, can you export the text you see in the red controls to a file, or another dialog that you'd be able to read, or can you put the whole thing in the clipboard?
Ruud Posted March 27, 2012 Author Posted March 27, 2012 Hey rodent1,I tried all of that; on 1 control nothing works, on the other 2 controls only sending keystrokes works - I need to loop through the words and copy by sending {DOWN} and {^C}. Though this is cumbersome, it does work - I was just hoping for something a bit higher-level, I guess.On the 1 other control, the only thing that works is OCR, which, as mentioned, is really really slow, and therefore unusable.Other tips are appreciated, I guess I laid my hope on the thread that WSorich mentioned ()Cheers!
Fubarable Posted April 6, 2012 Posted April 6, 2012 As has been mentioned -- what about using the clipboard? For instance, can you send "^a" to select all of the text held by the control (if it is some sort of edit control), then "^c" to copy it, then finally get the clipboard contents with ClipGet()? kmaclamore 1
kmaclamore Posted September 2, 2015 Posted September 2, 2015 As has been mentioned -- what about using the clipboard? For instance, can you send "^a" to select all of the text held by the control (if it is some sort of edit control), then "^c" to copy it, then finally get the clipboard contents with ClipGet()?I was having a similar issue as OP and this solved the problem, thanks!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now