Dana Posted May 1, 2012 Share Posted May 1, 2012 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 WEndSeems 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 More sharing options...
JohnQSmith Posted May 1, 2012 Share Posted May 1, 2012 (edited) Try replacing your SEND with this... Send("{ESC}{ESC}{ESC}{ESC}{ALTDOWN}F{ALTUP}EF{F7}{F1}") Edited May 1, 2012 by JohnQSmith Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes". Link to comment Share on other sites More sharing options...
Zedna Posted May 1, 2012 Share Posted May 1, 2012 (edited) Try to use Winspector to catch WM_COMMAND sent by your desired menu item when you invoke it.Then in Autoit send this WM_COMMAND to your application by _SendMessage()Search this forum for Winspector to get more information ...EDIT: for example here: Edited May 1, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Realm Posted May 1, 2012 Share Posted May 1, 2012 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 More sharing options...
Dana Posted May 1, 2012 Author Share Posted May 1, 2012 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 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