Jump to content

Recommended Posts

Posted (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:

image.png.27e63ac520d350cb74c0759ef22eaed6.png

I recognize that it looks like a problem with the smarteam app and not autoit, but maybe there's a way around it?

 

 

Edited by Dana
Posted (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 by Dana

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...