Jump to content

Send or ControlSend problem


Recommended Posts

I have a problem that likely nobody can duplicate, but maybe somebody's seen something like this?

This is automating a procedure in my CAD package. I need to manipulate the main pulldown menu, File-Export-Pdf. A bunch of Escapes to exit any command in the CAD program that may currently be active, ALT to highlight the menu, and send FEF:

WinActivate("Kubotek KeyCreator")
WinWaitActive("Kubotek KeyCreator")
;start pdf export dialog, select all disp-all
BlockInput(1)
Send("{ESC}{ESC}{ESC}{ESC}{ALT}FEF{F7}{F1}")

This almost always works, unless it's the first time I run it. In that case, the program seems to not get the {ALT}, and instead takes the first "F" as an entirely different command that has a single "F" key press (the program is all hotkeys).

I've tried using ControlSend instead, using the control ID as revealed by Autoit window info, but then it doesn't work at all, I always get the unwanted "F" command (actually there are two different "F" hotkeys, one uppercase and one lowercase.

I have a workaround:

while 1
Send("{ESC}{ESC}{ESC}{ESC}{ALT}FEF{F7}{F1}")
Sleep(500)
; next line catches missed {ALT} keystroke when a fillet dialog comes up, and retries since it only seems to happen once
If not (WinExists("Constant Radius Edge Blend") Or WinExists("Kubotek KeyCreator", "Enter radius")) then ExitLoop
WEnd

Seems to work (note I'm looking for the results of either the uppercase or lowercase "F"), but kludgy.

It appears to be a non standard control, including both the typical Windows File-Edit-...-Help menus, but also customizable icons all as part of a single control. I can understand that AutoIT wouldn't properly handle it, but failing the first time each session and not thereafter is just weird.

Link to comment
Share on other sites

Hello Dana,

Have you tried using WinMenuSelectItem() for interacting with the Context Menu?

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Try replacing your SEND with this...

Send("{ESC}{ESC}{ESC}{ESC}{ALTDOWN}F{ALTUP}EF{F7}{F1}")

That won't work because ALT-F is still another hotkey in the program, as opposed to ALT, F, which opens the pulldown.

Have you tried using WinMenuSelectItem() for interacting with the Context Menu?

Yes, I tried that before... does nothing. Again, I presume, because it's not a standard menu, it just looks like one.

If my kludge doesn't work long term I'll look into Winspector.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...