litlmike Posted March 1, 2006 Share Posted March 1, 2006 What are my options when ControlGetText doesn't work? I am trying to use ControlGetText, but the ControlID, ClassNameNN, and Text is not unique. I prefer not to use MouseClick(X,Y). Do I have other options? Below is my testing code for reading the fields. Attached is a .jpg so you can see the types of fields I am working with. Thanks in advance. $1 = ControlGetText ( "ACT!", "", 10034 );ID 10034 is for Company MsgBox(4096, "ControlGetText", $1, 5);The only one that Returns the Correct Result for Company Field $2 = ControlGetText ( "ACT!", "", 2 );ID 2 is for Contact MsgBox(4096, "ControlGetText", $2, 5);Returns a Blank Result $3 = ControlGetText ( "ACT!", "", 1001 );ID 1001 is for Title MsgBox(4096, "ControlGetText", $3, 5);Returns a Blank Result $4 = ControlGetText ( "ACT!", "", 10034 );ID 10034 is for Email Field, Also? MsgBox(4096, "ControlGetText", $4, 5);Returns the Company field Result :( _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 1, 2006 Moderators Share Posted March 1, 2006 Write an OCR and put it in a specific location? A thought, but I don't know how to do it... Maybe someone could elaborate, is to get all the Control Information under the mouse, and you could just move the mouse to each location. Or if someone knows how to do it from cursor position, you could just use tabs. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Stumpii Posted March 1, 2006 Share Posted March 1, 2006 I would rather tab through the text boxes copying out the data using the clipboard than use the mouse. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
litlmike Posted March 1, 2006 Author Share Posted March 1, 2006 Thanks for the replies, I may be able to accomplish this project by using {TAB}. However, is there a smarter way to accomplish this task when the ControlID is not unique? How about using Control Handle (HWND)? I have no idea what nuisances come with using that type of option. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 1, 2006 Moderators Share Posted March 1, 2006 (edited) Well, if they both have the same Control ID / ClassnameNN, I'm not sure how you would get a 'Unique' handle. Edit: Unless there is some type of unique text that is there always Edited March 1, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted March 1, 2006 Moderators Share Posted March 1, 2006 LxP is the one to ask on this, he helped me out here a while back with the same type of issue. From what I could tell he found some hidden tabs in the app I was trying to control. Here is a piece of the code:Local $AuditWin = 'Track-It! Audit' Local $NextButton = 'TElPopupButton2' Run('\\main\trackit\audit32.exe') WinWait($AuditWin, 'tabWelcome') ControlClick($AuditWin, '', $NextButton) WinWait($AuditWin, 'tabPrompt') ControlSetText($AuditWin, '', 'TElAdvancedEdit13', $Name) ControlSetText($AuditWin, '', 'TElAdvancedEdit11', $Phone) ControlSetText($AuditWin, '', 'TElAdvancedEdit7', $Email) ControlSetText($AuditWin, '', 'TElAdvancedEdit5', $Department) ControlClick($AuditWin, '', $NextButton) WinWait($AuditWin, 'tabPrompt2') ControlSetText($AuditWin, '', 'TElAdvancedEdit7', $InvLabel) ControlClick($AuditWin, '', $NextButton) SplashTextOn('Audit in progress', @LF & 'Please wait...', 144, 64) WinWait($AuditWin, 'tabHardware')Keep in mind this program had no visible tabs, just input fields with a next button, then more input fields. Link to comment Share on other sites More sharing options...
seandisanti Posted March 1, 2006 Share Posted March 1, 2006 what does the autoit window info tool show for the controls? could you paste screenshots or text contents of the window info tool for a couple of controls? also, is this an application running on your computer, or via citrix (or other remote connection). one thing you may look at is ControlGetHandleByPosition() or something like that. i want to say LXP wrote it... i'll see if i can find a link for you... Link to comment Share on other sites More sharing options...
herewasplato Posted March 1, 2006 Share Posted March 1, 2006 (edited) ...could you paste screenshots or text contents of the window info tool for a couple of controls?...You might find them in this post on the same topic:http://www.autoitscript.com/forum/index.ph...ndpost&p=155388 Edited March 1, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
seandisanti Posted March 1, 2006 Share Posted March 1, 2006 You might find them in this post on the same topic:http://www.autoitscript.com/forum/index.ph...ndpost&p=155388you're right, the requested info was there... odd that the latest duplicate post would be LESS specific if the OP wasn't happy with responses the first time... Link to comment Share on other sites More sharing options...
litlmike Posted March 2, 2006 Author Share Posted March 2, 2006 what does the autoit window info tool show for the controls? could you paste screenshots or text contents of the window info tool for a couple of controls? also, is this an application running on your computer, or via citrix (or other remote connection). one thing you may look at is ControlGetHandleByPosition() or something like that. i want to say LXP wrote it... i'll see if i can find a link for you...This application is running on my PC. I can post the .txt with the copy/pasted info if need, but it is available on another post at Copy/Pasted Info for the Windowsyou're right, the requested info was there... odd that the latest duplicate post would be LESS specific if the OP wasn't happy with responses the first time...I was LESS specific because I have found that sometimes a better response will come on the forums. Meaning, maybe my question was TOO specific and therefore overwhelming to the reader. When instead, maybe an answer can come if I am just looking for a command that I was unaware of; i.e. MouseClick(), etc. And, as predicted, I got a much better response in this post. Hehe.So back to the matter... When you take a look at the .txt, can you see how I can get a hold of the Text in the Fields, even though the ControlID is not unique?Thanks again for the replies. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
LxP Posted March 3, 2006 Share Posted March 3, 2006 The ClassNameNN for any particular control on that window would certainly be unique. You might like to try this newly-posted script to determine which ClassNameNNs you need. Link to comment Share on other sites More sharing options...
seandisanti Posted March 3, 2006 Share Posted March 3, 2006 This application is running on my PC. I can post the .txt with the copy/pasted info if need, but it is available on another post at Copy/Pasted Info for the WindowsI was LESS specific because I have found that sometimes a better response will come on the forums. Meaning, maybe my question was TOO specific and therefore overwhelming to the reader. When instead, maybe an answer can come if I am just looking for a command that I was unaware of; i.e. MouseClick(), etc. And, as predicted, I got a much better response in this post. Hehe.So back to the matter... When you take a look at the .txt, can you see how I can get a hold of the Text in the Fields, even though the ControlID is not unique?Thanks again for the replies.i actually downloaded the Act! trial version at home the other night to see if i couldn't figure something out for you, but i've been pretty busy and haven't even installed it yet... i'll probably have somethign for you by monday. Link to comment Share on other sites More sharing options...
litlmike Posted March 6, 2006 Author Share Posted March 6, 2006 Well, good news and bad news. Good News: LXP made an awesome script that will help us in future, that he posted above. It works great for most of the windows I tried it on. LXP's ScriptBad News: It works great for most of the windows I tried it on. In that, I still have the same problem. The script by LXP returned a great tree view, but the info only proved helpful for 1 field on the window, which is the same field I was already able to capture.What it did help me to identify is that the AutoIt window, and the LXP script only provide me with info for 1 of the fields (the company field). UNLESS I first click one of the other fields. For example, for the Name field I can not find a Control ID or ClassNameNN, unless I first mouse click on that field. I was happy to find that LXP's script did give me a result. However, ControlGetText still did not work for the Name field, when using the values that LXP's script produced.I cant copy/paste with LXP's script, so here is the data from the 4 fields I tried his script on.Company Edit1(the next 3 only occur after I mouse click on the field)Name AfxWnd421Title ComboBox1 also Edit1Email Edit1Does anyone have any ideas for me?i actually downloaded the Act! trial version at home the other night to see if i couldn't figure something out for you, but i've been pretty busy and haven't even installed it yet... i'll probably have somethign for you by monday.Thanks for your willingness to do that. I am using ACT! Build 6.0.0.679. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
seandisanti Posted March 6, 2006 Share Posted March 6, 2006 Well, good news and bad news. Good News: LXP made an awesome script that will help us in future, that he posted above. It works great for most of the windows I tried it on. LXP's ScriptBad News: It works great for most of the windows I tried it on. In that, I still have the same problem. The script by LXP returned a great tree view, but the info only proved helpful for 1 field on the window, which is the same field I was already able to capture.What it did help me to identify is that the AutoIt window, and the LXP script only provide me with info for 1 of the fields (the company field). UNLESS I first click one of the other fields. For example, for the Name field I can not find a Control ID or ClassNameNN, unless I first mouse click on that field. I was happy to find that LXP's script did give me a result. However, ControlGetText still did not work for the Name field, when using the values that LXP's script produced.I cant copy/paste with LXP's script, so here is the data from the 4 fields I tried his script on.Company Edit1(the next 3 only occur after I mouse click on the field)Name AfxWnd421Title ComboBox1 also Edit1Email Edit1Does anyone have any ideas for me?Thanks for your willingness to do that. I am using ACT! Build 6.0.0.679.i actually got tied up all weekend fulfilling my gambling addiction... i will try to get somethign for you tonight Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted March 6, 2006 Moderators Share Posted March 6, 2006 I also downloaded ACT! 2006 and installed it. In this version all the edit fields had this format for ClassNameNN's: WindowsForms10.EDIT.app*** Where *** was either a 2 or 3 digit number. These seemed to change each time you created a new contact or closed and reopened the program. Not sure if this is the case in the version you have? The best way to find what each fields ClassNameNN is, is by entering something unique in each one, then run LxP's script and look for the values you entered. Copy down that information, then close the program or create a new contact and repeat the last step and see if they are the same. Good luck! Link to comment Share on other sites More sharing options...
litlmike Posted March 6, 2006 Author Share Posted March 6, 2006 I also downloaded ACT! 2006 and installed it. In this version all the edit fields had this format for ClassNameNN's: WindowsForms10.EDIT.app*** Where *** was either a 2 or 3 digit number. These seemed to change each time you created a new contact or closed and reopened the program. Not sure if this is the case in the version you have? The best way to find what each fields ClassNameNN is, is by entering something unique in each one, then run LxP's script and look for the values you entered. Copy down that information, then close the program or create a new contact and repeat the last step and see if they are the same. Good luck! Of course, in the build I have, it does NOT have the ClassNameNN in the format you mentioned. What it does have is what I posted above (and below). Luckily, the ClassNameNN is the same for every contact. But, for Name (Contact), Title, Email those ClassNameNN ONLY show once I have mouse clicked on that field. Maybe we can focus on answering that question first. Why does the ClassNameNN only show after I have mouse clicked on that field? ClassNameNN: Company Edit1 (the next 3 only occur after I mouse click on the field) Name AfxWnd421 Title ComboBox1 also Edit1 Email Edit1 I am using ACT! Build 6.0.0.679. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted March 6, 2006 Moderators Share Posted March 6, 2006 Of course, in the build I have, it does NOT have the ClassNameNN in the format you mentioned. What it does have is what I posted above (and below). Luckily, the ClassNameNN is the same for every contact. But, for Name (Contact), Title, Email those ClassNameNN ONLY show once I have mouse clicked on that field. Maybe we can focus on answering that question first. Why does the ClassNameNN only show after I have mouse clicked on that field?To be honest I don't think you need to worry about why, but figure out a way around it. Did you try the method that I posted in my last reply? Fill in all the contact info, use LxP's script to pull the ClassNameNN's and look for the info you provided in the contact fields. Link to comment Share on other sites More sharing options...
LxP Posted March 7, 2006 Share Posted March 7, 2006 Company Edit1(the next 3 only occur after I mouse click on the field)Name AfxWnd421Title ComboBox1 also Edit1Email Edit1Does anyone have any ideas for me?At any one point in time no two controls simultaneously share a ClassNameNN. The information above contradicts this, which suggests to me that ACT! is modifying the window (introducing/removing controls) as different controls are clicked.Perhaps some carefully crafted ControlClick() calls could be all that's necessary to get access to the needed fields. (You could try calling ControlClick() on some of the ClassNameNNs that are available to see if it helps.)With regard to WindowsForms10.EDIT.app... ClassNameNNs: these are the indication of a program written with Microsoft .NET. The ClassNameNNs will be random each time that the window is shown, making automated control manipulation difficult but not impossible. As the controls always appear in a specific location, such location information can then be passed to the _ControlGetHandleByPos() UDF to get a reliable handle to such controls.One final idea: is there a way to enter information into ACT! via the command line or some other non-GUI path? Link to comment Share on other sites More sharing options...
litlmike Posted March 7, 2006 Author Share Posted March 7, 2006 At any one point in time no two controls simultaneously share a ClassNameNN. The information above contradicts this, which suggests to me that ACT! is modifying the window (introducing/removing controls) as different controls are clicked. Perhaps some carefully crafted ControlClick() calls could be all that's necessary to get access to the needed fields. (You could try calling ControlClick() on some of the ClassNameNNs that are available to see if it helps.) With regard to WindowsForms10.EDIT.app... ClassNameNNs: these are the indication of a program written with Microsoft .NET. The ClassNameNNs will be random each time that the window is shown, making automated control manipulation difficult but not impossible. As the controls always appear in a specific location, such location information can then be passed to the _ControlGetHandleByPos() UDF to get a reliable handle to such controls. One final idea: is there a way to enter information into ACT! via the command line or some other non-GUI path? I gave ControlClick () another try, with no luck. I will try a few more times with some variations. Just to make sure I am using it correctly, this is the code I have for it. Double check it for me please ControlClick ( "ACT!", "", "Edit1", "left", 10) Btw, I do not have ACT! version 2006 it is version 6.0.0.679. It sucks, I hate it, but thats all we have. So WindowsForms10.EDIT.app... isn't an issue, because it doesn't exist on this version. At any one point in time no two controls simultaneously share a ClassNameNN. The information above contradicts this, which suggests to me that ACT! is modifying the window (introducing/removing controls) as different controls are clicked. I think that is a wise and true statement. Is there anyway to enable your script to capture (copy/paste) the info it gives me. It might help if I could post it here. I am gonna give _ControlGetHandleByPos(), but frankly I am not familiar with it, and it will take some time. I will try to get back to you in a couple of hours. One final idea: is there a way to enter information into ACT! via the command line or some other non-GUI path? Maybe. But I have no idea of how to find out. Also, I am trying to retrieve info from ACT, not put it into ACT. Thanks everyone for the input. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 ControlClick ( "ACT!", "", "Edit1", "left", 10)^^ Clicks the Edit1 control 10 x's all at the same time, is that what your trying to achieve?I am gonna give _ControlGetHandleByPos()That's a great idea I do not have ACT! version 2006 it is version 6.0.0.679ACT! is a rather cumbersome database anyway (comparatively speaking)... why did you guys chose that platform rather than the others out there? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
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