Lococobra Posted August 15, 2011 Share Posted August 15, 2011 (edited) I am writing some automation for an application (I have no control over the target application or how it is written). I know that the application is written using the .NET Framework.I have had (for the most part) no trouble writing to the controls in the target app. I can.. for example.. check a checkbox, click a button, focus controls, change a control's background color, etc... but writing is only half the battle.Almost every control thus far has resisted being read from. Examples:ControlCommand "IsChecked" always returns 0.ListViews will return the number of elements (rows), but will not return any text from their fields.StatusBars will not return textI've tried every method I've found to make this work, I've of course tried all of the standard control methods built in (ControlGetText, ControlCommand, ControlListView, etc..), and I've also tried using many of the alternative methods (_GUICtrlStatusBar_GetText, _GUICtrlButton_GetCheck, and a bunch of others I don't remember). Nothing works.What you're probably thinking is:You must be doing it wrong.Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!Well at least for #1: I've worked with AutoIt for more than two years. I have done this exact kind of automation with other applications and had no issues.I fully expect the answer here to be "It is impossible", but I would love to be proven wrong. I must not be the only one! Has anyone figured out how to work with these damn .NET GUI controls? Edited August 15, 2011 by Lococobra Link to comment Share on other sites More sharing options...
Lococobra Posted August 16, 2011 Author Share Posted August 16, 2011 bump... Link to comment Share on other sites More sharing options...
JohnOne Posted August 17, 2011 Share Posted August 17, 2011 Reckon you need to post some code of what you've tried. Your post suggests you have tried everything, so its difficult to suggest anything. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Lococobra Posted August 17, 2011 Author Share Posted August 17, 2011 (edited) Reckon you need to post some code of what you've tried.Your post suggests you have tried everything, so its difficult to suggest anything.Well the question is really.. Is there anything I am just obviously completely unaware of? I've done extensive searching through the forums as well looked for non-autoit solutions and I'm out of things to try. As you say, I do believe I've tried everything.So yeah, any out of the box methods of automating windows controls? Edited August 17, 2011 by Lococobra Link to comment Share on other sites More sharing options...
monoscout999 Posted August 17, 2011 Share Posted August 17, 2011 still no code... so still no help Link to comment Share on other sites More sharing options...
Lococobra Posted August 17, 2011 Author Share Posted August 17, 2011 (edited) Okay... don't take my word for it then. So for example, here are some of my attempts to evaluate the status of a checkbox. Local $HWND = WinGetHandle("Testing123") Local $CTRL = ControlGetHandle($HWND, "", "[NAME:chkSelectAll_8]") WinActivate($HWND) ;Works ControlCommand($HWND, "", $CTRL, "Check") ;Works but toggles the checkbox instead of setting it to checked ("UnCheck" has no effect at all) Sleep(1000) ;The obvious way of doing it.. MsgBox(0, '', ControlCommand($HWND, "", $CTRL, "IsChecked", "")) ;No dice... lets try this instead? MsgBox(0, '', _GUICtrlButton_GetCheck($CTRL)) ;Maybe there's a bug in the _GUICtrlButton_GetCheck implementation? Local Const $MY_BM_GETCHECK = 0xF0 Local $ret = DLLCall("user32.dll","int","SendMessage", _ "hwnd",$CTRL, _ "int",$BM_GETCHECK) If @error Then MsgBox(0, '', 'error: '&@error) Else MsgBox(0, '', $ret[0]) EndIf All of the above return "0" if the checkbox is checked or unchecked. Edited August 17, 2011 by Lococobra Link to comment Share on other sites More sharing options...
JohnOne Posted August 17, 2011 Share Posted August 17, 2011 (edited) I dont know if this is how it works, but I know Autoit3 cannot access the .Net framework.Sounds as though its acting more like a Edited August 17, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Lococobra Posted August 17, 2011 Author Share Posted August 17, 2011 I dont know if this is how it works, but I know Autoit3 cannot access the .Net framework.Yes, this would certainly seem to be the case, which is why I'm asking for other answers.Sounds as though its acting more like a Although I have no control over the application, I have talked to its developers a handful of times and I know with 100% certainty that it is written entirely using the .NET framework. 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