2
votes

I have a dictionary application in which Ctrl+C does not work, so the only way to copy is to go from the menu, Edit > Copy. I have tried using the following code and variations of it, but it did not work.

enter image description here

!l::
WinActivate, MAGENTA - Dictionaries Explorer II
WinMenuSelectItem, ahk_class TMainForm,, Edit, Copy
return

WinSpy data:

MAGENTA - Dictionaries Explorer II
ahk_class TMainForm
ahk_exe MgDE2.EXE
ahk_pid 2580
1
Maybe you will have to use SendMessage, check PostMessage / SendMessage Tutorial - Yane
I do not understand the instructions to get he values in that tutorial i.e. "Drag the crosshair..." I do not see any crosshair in WinSpy. - greektranslator
Do accelerator keys work, like Alt+E to get into the menu item? If yes you can use those in your script. Also you can use automated mouse clicks to do this. - Mikhail V
No accelerator keys. The mouse click events is what I had already used (this is not an option that will work for all users due to possible differences in app UI and system resolution). - greektranslator
The "gripper" on the left side of the "menu bar" shows that it is not really a menu bar, but something like a Rebar control. You cannot use WinMenuSelectItem on this. SendMessage is your best bet; you just need to find the right ID, as per the tutorial @Yane mentioned. - Lexikos

1 Answers

0
votes

Forgetting AHK for a minute, if you just press and release the Alt key (all by itself) what happens?

If the File menu activates (blue box), then you can just send the ALT keystroke followed by directional movement as needed and finally sending ENTER to activate the item

Like this

SendInput {Alt}{Right}{Down}{Enter}

If you needed to go right 4 elements and then down 2 entries you would use this way:

SendInput {Alt}{Right 4}{Down 2}{Enter}