Jean Lalonde Support Forum

Full Version: #32770 dialog detection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Haven't tried QAP (yet), but read this on the website:



Quote:If the dialog box is not an Open or Save As dialog box, if it is an Options dialog box instead, for example, QAP cannot detect it (because all dialog boxes have the same class name “#32770”, regardless of the dialog box task) and QAP will act as if it was a file dialog box.

To change folder, QAP tries to change the content of a text field of the dialog box named internally “Edit1” or “Edit2” (in a file dialog box, this field is usually labeled File name). If it succeeds, QAP sends “Enter” to press the OK button of the dialog box. In a file dialog box, it changes the current folder in the dialog box. Then, QAP restores the initial content of the Filename field and stops, letting the user continue his work.


I recently wrote 2 AHK utilities that had to detect File dialogs ("common item dialog") too.
The following works reliable in my (and others) experience. No false positives; no false negatives.


When in a #32770 control:

Code:
;_____________________________________________________________________________
;
SmellsLikeAFileDialog(_thisID )
;_____________________________________________________________________________
;
{

; Only consider this dialog a possible file-dialog when:
; (SysListView321 AND ToolbarWindow321) OR (DirectUIHWND1 AND ToolbarWindow321) controls detected
; First is for Notepad++; second for all other filedialogs
; Returns dialogtype (General/SyslistView) or 0/FALSE

WinGet, _controlList, ControlList, ahk_id %_thisID%

Loop, Parse, _controlList, `n
{
If ( A_LoopField = "SysListView321"  )
_SysListView321 := 1

If ( A_LoopField = "ToolbarWindow321")
_ToolbarWindow321 := 1

If ( A_LoopField = "DirectUIHWND1"  )
_DirectUIHWND1 := 1

If ( A_LoopField = "Edit1"  )
_Edit1 := 1
}


If ( _DirectUIHWND1 and _ToolbarWindow321 and _Edit1 )
{
Return "GENERAL"

}
Else If ( _SysListView321 and _ToolbarWindow321 and _Edit1 )
{
Return "SYSLISTVIEW"
}
else
{
Return FALSE
}

}



Just sharing ...


NotNull

----

For my  current method used to change the active folder see
JumpToFolder (change folders using Everything) or QuickSwitch (like Listary's QuickSwitch) on GitHub.


I did write a new method to change teh active folder, but that requires (a lot) more testing, as there are quite a few deviant dialogs around ..
It seems a good solution to a pretty tricky issue. I'll work on it for the next release.

Thanks NotNull for sharing your code.

Jean
This code is now used in the latest QAP release v11.5.7. Please report issues here if QAP can't change folder in some file dialog boxes.
https://forum.quickaccesspopup.com/showt...p?tid=2032
Hi NotNull,

A user reported an issue opening the QAP menu in THE "File, Open" dialog box of Autodesk Revit with the latest QAP release v11.5.7 using your function SmellsLikeAFileDialog. You may find in the diagnostic info below how you could refine your function, if you wish. For now, I'll return to my previous algorithm to detect file dialog boxes in v11.5.7.1 (to be released next week).

Window Title: Open
Class: #32770
ID: 0x3d0ca6
Parent Window Title: Autodesk Revit 2023 - [A2224-ACE Hardware_ASearcy.rvt - Section: END WALL SECTION2]
Parent Class: HwndWrapper[DefaultDomain;;0076f556-d891-4fdc-b711-b6a481743ed0]
Parent Process: Revit.exe

WindowIsDialog: 1 ; value returned by the function I used before v11.5.7
SmellsLikeAFileDialog: 0 ; returns false (should return GENERAL in this case)

strControlsList:
Static1
ComboBox1
Edit1
Static2
ComboBox2
Button1
Button2
Button3
Button4
Button5
Static3
ComboBox3
Button6
Button7
Button8
Button9
Button10
ComboBox4
ListBox1
SHELLDLL_DefView1
SysListView321
SysHeader321
Static4
Button11
Static5
Button12
Button13
Button14
Static6
Static7

AS REFERENCE, HERE IS THE INFO RETURNED FOR NOTEPAD ON THE SAME PC

Window: Open
Class: #32770
ID: 0x100f16
Parent Window: New Text Document.txt - Notepad
Parent Class: Notepad
Parent Process: NOTEPAD.EXE

WindowIsDialog: 1
SmellsLikeAFileDialog: GENERAL

strControlsList:
DUIViewWndClassName1
DirectUIHWND1
CtrlNotifySink1
NamespaceTreeControl1
Static1
SysTreeView321
CtrlNotifySink2
Shell Preview Extension Host1
CtrlNotifySink3
SHELLDLL_DefView1
DirectUIHWND2
CtrlNotifySink4
ScrollBar1
CtrlNotifySink5
ScrollBar2
Static2
ComboBoxEx321
ComboBox1
Edit1
Static3
ComboBox2
Static4
ComboBox3
Button1
Button2
ScrollBar3
Static5
Static6
Static7
ListBox1
Static8
Button3
WorkerW1
ReBarWindow321
TravelBand1
ToolbarWindow321
UpBand1
ToolbarWindow322
Address Band Root1
msctls_progress321
Breadcrumb Parent1
ToolbarWindow323
ToolbarWindow324
ComboBoxEx322
ComboBox4
Edit2
SeparatorBand1
UniversalSearchBand1
ModernSearchBox1
SeparatorBand2