Page 1 of 1

Can't get the 450XX codes to work for macros

Posted: 2021 Aug 14, 19:02
by otlaolap
The 450XX command codes, corresponding to the keystrokes 0-9 overlaid with various combinations of Ctrl, Alt, and Shift, work fine for user commands but are apparently ignored for macros. I assign a command the hotkey Alt+1 and 45011 will trigger it. I assign a macro the hotkey Alt+2 and 45012 does nothing. I hope the problem is that I am doing something wrong and that this is not by design. Pointers? Thanks.

[What follows is an edit.]

Actually, I think now that the 450XX is working but the macro is not. The macro I am testing is one of the sample ones:

Code: Select all

FINDWND address
FINDCLASS combobox
SETTEXT "c:\"
SENDKEY enter
The address bar does get set to "c:\", but the enter key never gets pressed. I can't make enter work. And that is the real nub of my problem. If I execute this macro by using the context menu, the enter works. If I send the 45013 code, the enter does not work. So I think the problem I am seeing is that the enter command does not work unless the keyboard itself is used to start the macro (using the menu to get to it or the shortcut key assigned to it). There does not seem to be a way to automate an enter unless the X2 window is actually the active window. So I'll go away quietly now.

But what I would like to be able to do is to cause an X2 window, whose handle I know. to browse into an arbitrary directory specified on the fly. What I thought to do is to set that directory name into the address bar, and then use the macro to send enter. Activating the window with code is not always successful, as Windows is running stuff asynchronously. Would welcome a pointer to a guaranteed successful method. It does seem to me, though, that the X2 macro line "SENDKEY ENTER" ought to do what it says if it is talking to itself.

Re: Can't get the 450XX codes to work for macros

Posted: 2021 Aug 15, 01:40
by otlaolap
Well, I have found a way that is working at this time. Been working on this problem for a day and a half, and I swear I tried this before and it didn't work, but it is working now. From AutoHotkey I run this:

Code: Select all

; Edit1 is the name given by AHK to the edit box in the address bar
ControlSetText, Edit1, G:\Memoranda\House Maintenance, ahk_id %TheWindowHandleOfTheX2WindowToBeManipulated%
ControlFocus, Edit1, ahk_id %TheWindowHandleOfTheX2WindowToBeManipulated%
ControlSend, Edit1, {Enter}, ahk_id %TheWindowHandleOfTheX2WindowToBeManipulated%
The X2 window does not have to be active at the time this is run. It does go to the requested directory. A side effect is that it does become the active window, but that is OK for what I am doing.

Re: Can't get the 450XX codes to work for macros

Posted: 2021 Aug 15, 10:31
by nikos
in general, when a macro is running, xplorer2 should be active ,especially if you are sending keys to windows. I understand it is a limitation of the macro system