windows - 打开-保存对话框自动打开当前在 Windows 资源管理器中打开的文件夹
问题描述
我想实现一个以这种方式工作的程序:我在 Windows 资源管理器中打开了一个文件夹。我在一个程序中工作,我想保存我的工作。我打开打开/保存对话框,我想要一个快捷方式来自动跳转到当前在 Windows 资源管理器中打开的文件夹。
我认为 AutoHotKey 应该可以解决问题,但我不知道该怎么做。也许最好的解决方案是:
- 在 Windows 资源管理器中设置保存当前活动文件夹的快捷方式
- 设置另一个快捷方式,使当前打开的打开保存对话框跳转到保存的目录。
是否有可能在 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
推荐阅读
- python - python中的回文函数没有返回预期结果
- mysql - 在查询中使用联合连接两个表
- excel - 行删除脚本 - 日期之间的比较不起作用
- sql - 如何获取与 ID 关联的所有时间戳并将其聚合为总时间?
- azure-cosmosdb - 确保 Cosmos db 中 SP 中操作/事务的原子性
- postgresql - 防止可能的 PostgreSQL GUC 参数竞争条件?
- c - 只能将 Char* 写入 LPVOID 缓冲区吗?
- python - 从 excel 创建数据框
- python - 我正在尝试调用一种方法来检查班级中的值,但仍然不断收到错误的输出
- python - Python 上的 ASCII 动画