I tried to add support for Q-Dir.
Now since it has 4 panels, I followed a similar approach as to the 2 panel 7z.
Unfortunately, the Mousegetpos needed to be done before the user moves the mouse to a new position (to select the folder) as this frequently caused the wrong panel to be used.
So I added
Code:
f_DisplayMenu:
; These first few variables are set here and used by f_OpenFavorite:
WinGet, w_WinID, ID, A
WinGet, w_WinMin, MinMax, ahk_id %w_WinID%
if w_WinMin = -1 ; Only detect windows not Minimized.
return
WinGetClass, w_Class, ahk_id %w_WinID%
MouseGetPos, , , , w_Control_Qdir ; new line added, the rest is for context
w_Control_Qdir can potentially be renamed and re-used for other programs
Then in f_OpenPath() I added
Code:
;Q-Dir
if w_Class = ATL:00470C10
{
if w_Control_Qdir = SysListView321 ; First panel
{
ControlClick, Edit3, ahk_id %w_WinID%
ControlSetText, Edit3, %ThisPath%, ahk_id %w_WinID%
ControlFocus , Edit3, ahk_id %w_WinID%
sleep,100
ControlSend, Edit3, {Enter}, ahk_id %w_WinID%
Send, {Enter}
}
else
if w_Control_Qdir = SysListView322 ; Second panel
{
ControlClick, Edit5, ahk_id %w_WinID%
ControlSetText, Edit5, %ThisPath%, ahk_id %w_WinID%
ControlFocus , Edit5, ahk_id %w_WinID%
sleep,100
ControlSend, Edit5, {Enter}, ahk_id %w_WinID%
Send, {Enter}
}
else
if w_Control_Qdir = SysListView323 ; Third panel
{
ControlClick, Edit7, ahk_id %w_WinID%
ControlSetText, Edit7, %ThisPath%, ahk_id %w_WinID%
ControlFocus , Edit7, ahk_id %w_WinID%
sleep,100
ControlSend, Edit7, {Enter}, ahk_id %w_WinID%
Send, {Enter}
}
else
if w_Control_Qdir = SysListView324 ; Fourth panel
{
ControlClick, Edit9, ahk_id %w_WinID%
ControlSetText, Edit9, %ThisPath%, ahk_id %w_WinID%
ControlFocus , Edit9, ahk_id %w_WinID%
sleep,100
ControlSend, Edit9, {Enter}, ahk_id %w_WinID%
Send, {Enter}
}
}
Which works great 90% of the time.
The problem is that Send, {Enter} and ControlSend, Edit9, {Enter}, ahk_id %w_WinID% does not work the other about 10% If I only have one of these lines, the success rate decrease dramatically, and inserting sleep commands seem to have no impact.
Is there anything else that I can try to correctly send the enter key?