When running Directory Opus with in "Dual Vertical Folder" mode, I'm trying to activate the folder under the mouse cursor using AutoHotkey (AHK).
I have this AHK code to enable the DOpus lister window:
#requires AutoHotkey v1.1
#SingleInstance,Force
#NoEnv
MouseGetPos, , , strWinID
WinActivate, ahk_id %strWinID% ; strWinID contains the ID of the window under the mouse cursor
This activates the DOpus window but, as expected, this do not change the active folder. If the left folder was active, it remains active even if the mouse was under the right folder.
Actually, the only way to activate the right folder is to use the AHK Click command at the current mouse position. Doing this activate the folder but it has the side effect of deselecting the selected files which interferes with the workflow.
Any idea how the folder under the cursor could be activated without using Click? Maybe using DOpusRt?
Thanks.
Note: I was not sure if I should ask this question on AHK forum or DOpus forum. I decided to ask on both.
What's the overall thing you're trying to do that this is part of? There may be a more direct way to do it as a whole.
Sure. In Quick Access Popup (QAP), when you open the popup menu over a file manager window (Windows Explorer, DOpus, etc.) and you choose a folder in the menu, QAP changes the location to the chosen folder in that file manager window (as you know, in DOpus, QAP is calling DOpusRt to achieve this).
In DOpus, because there can be two folders displayed (let's call them two panes), QAP needs to know under which pane the menu was open in order to change the location in that pane. If the left pane is active and the menu is open over the right pane, QAP must ask DOpusRt to change the location in the right pane. The solution that worked for years was simply to send a "Click" command at the mouse location before opening the QAP menu. That way, in my previous example, the right pane was activated before the QAP menu was open and the location was changed correctly.
But because of a new feature allowing to take action on the selected files or folders, this "Click" command has the bad effect of de-selecting the selected items, causing the desired action to take effect only on the selected item (the item under the mouse pointer when the "Click" command was sent).
The DOpusRT /info XML should give you what you need. I think you're already using this for some other things.
For example:
dopusrt.exe /info %temp%\pathlist.txt,paths
That'll give a list of all windows and folder tabs, and tells you which are active.
Here's an example with one tab on the left and two on the right. I've rearranged and padded the information slightly to make it easier to read and put the important (for this) stuff first:
The lister and tab values give you the HWNDs for the respective windows (top-level and child, respectively). You can compare those to the HWND for the window under the mouse which you get from AHK (or the Windows API in the more general case).
The side value tells you if something is on the left/top or right/bottom, if that's needed.
The tab_state value is 1 for a source tab and 2 for a destination tab.
So from that you can find the tab under the mouse and know if it's the source or destination. If it's already the source then you don't need to do anything extra, and if it's the destination you can send Opus a Set FOCUS=left or ...=right command to make it the source.
That help, for sure. Yes, I'm familiar with this DOpusRt path command.
With AHK command MouseGetPos, I can get the HWND of the lister window and class of the control (tab) under the mouse. For example, for tabs, I get dopus.filedisplay1, dopus.filedisplay2, etc. I can't find how to get the control HWND to compare it with the tab="0x50e1a" info from the path command. But this is now a topic for the AHK forum.