Dana Posted October 1, 2019 Posted October 1, 2019 (edited) I'm having trouble with the pulldown menu in a program I'm automating. I've tried using Send as well as ControlSend. Both work, most of the time, until they don't. I have: WinActivate("ENOVIA SmarTeam") WinWaitActive("ENOVIA SmarTeam") Sleep(100) ConsoleWrite("return" & ControlFocus("ENOVIA SmarTeam", "", "[CLASS:TAdvToolBar; INSTANCE:1]")) ;ControlSend("ENOVIA SmarTeam", "", 200996, "!AACKK") ControlSend("ENOVIA SmarTeam", "", "[CLASS:TAdvToolBar; INSTANCE:1]", "!AACKK") ;Send("!aackk") WinWait("ENOVIA SmarTeam", "KeyCreator Drawing") ; new card created but not filled out yet The ControlSend using the CLASS seems to work the best. The commented out one using the ID is intermittent as the ID seems to change, and Send is equally unreliable. But with any of them, it seems that I just can't always get the focus to go to the control, nor will it accept the keystrokes. Sometimes it works and sometimes it doesn't. But when it fails, hitting ALT-A on the keyboard won't get to the control, either, but if I mouse click on it, then it accepts the remaining keystrokes. In this case the ControlFocus line returns 0 instead of 1. This is what should happen: I recognize that it looks like a problem with the smarteam app and not autoit, but maybe there's a way around it? Edited October 1, 2019 by Dana
Moderators JLogan3o13 Posted October 1, 2019 Moderators Posted October 1, 2019 @Dana have you looked at WinMenuSelectItem? It may be better as you trawl through submenus, as it lets you go up to 6 sub-menus deep "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Dana Posted October 1, 2019 Author Posted October 1, 2019 (edited) I tried WinMenuSelectItem some time ago without success, I guess it's not a standard menu. Looks like ControlClick works even when ControlSend doesn't, though as it's intermittent I'm having a hard time proving it. I now have this to monitor it in actual use: If Not ControlSend("ENOVIA SmarTeam", "", "[CLASS:TAdvToolBar; INSTANCE:1]", "!AACKK") Then ; sometimes the menu doesn't respond to keystrokes ControlClick("ENOVIA SmarTeam", "", "[CLASS:TAdvToolBar; INSTANCE:1]", "main", 1, 77, 12) ControlSend("ENOVIA SmarTeam", "", "[CLASS:TAdvToolBar; INSTANCE:1]", "ACKK") MsgBox(4096, "debug", "ControlSend failed, used alternate") EndIf Edited October 1, 2019 by Dana
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