打开保存对话框自动打开当前在 Windows 资源管理器中打开的文件夹

Open-save dialog automatically opens the folder which is currently opened in Windows Explorer

我想实现一个以这种方式工作的程序: 我在 Windows 资源管理器中打开了一个文件夹。我在一个程序中工作,我想保存我的工作。我打开 Open/save 对话框,我想要一个快捷方式来自动跳转到当前在 Windows 资源管理器中打开的文件夹。

我认为 AutoHotKey 应该可以解决问题,但我不知道如何继续。 也许最好的解决方案是:

AHK可以实现吗?怎么做?

示例(使用新的记事本文档):

#IfWinActive ahk_class Notepad

    F1::
        explorer_path := "" ; empty variable
        IfWinNotExist ahk_class CabinetWClass ; explorer
            return  ; do nothing
        ; otherwise:
        ; https://autohotkey.com/boards/viewtopic.php?p=28751#p28751
        ; get the path of the first explorer window:
        for window in ComObjCreate("Shell.Application").Windows
        {
            try explorer_path := window.Document.Folder.Self.Path
                    break
        }
        ; MsgBox, %explorer_path%
        Send, ^s ; save the new document
        ; wait for the Save As window and activate it
        WinWait, Save As ahk_class #32770
        WinActivate, Save As ahk_class #32770
        WinWaitActive, Save As ahk_class #32770
        ; open the folder "explorer_path" in Save As
        SendInput, %explorer_path%
        Sleep, 300
        Send, {Enter}
    return

#IfWinActive