如何确定 Select 文件对话框何时处于活动状态?

How to determine when the Select File Dialog is active?

我正在尝试确定 文件选择对话框 何时处于活动状态,但我做不到。

SetTitleMatchMode,1
FileSelectFile, SelectedFile
Winwaitactive,Select File - 
Msgbox,File Select Dialog is active    ; This is never fired
if (SelectedFile = "")
    MsgBox, The user didn't select anything.
else
    MsgBox, The user selected the following:`n%SelectedFile%

你能告诉我我做错了什么吗?

在该线程上,代码执行在 FileSelectFile 行停止,直到选择了一个文件。因此,您的代码永远不会通过 WinWaitActive 命令,因为在该命令运行时,您尝试匹配的 window 不再打开。
by the looks of things,您不能在不破坏 FileSelectFile 命令功能的情况下中断该线程。
因此,如果没有真正的多线程,您想要做的事情是不可能的。

但也许您可以像这样做一个简单的假设:

MsgBox, % "File select will begin after you click OK"
FileSelectFile, output
MsgBox, % "File select ended"