我使用 autohotkey 版本:1.0.48.05(因为我坚持使用 activeaid)。
读取当前路径的脚本如下(一直有效到Win 7)。
; Get full path from open Explorer window
WinGetText, FullPath, A
; Clean up result
StringReplace, FullPath, FullPath, `r, , all
FullPath := RegExReplace(FullPath, "^.*`nAddress: ([^`n]+)`n.*$", "$1")
我怎么怀疑,在切换到Win10的同时,我似乎也切换了语言。
如果我在清理之前 MsgBox 输出了 %FullPath%
WinGetText、完整路径、A
消息框%FullPath%
我在其他字符串中看到(显然由 CR 分隔):
地址:V:\Vertrieb\Prospects\MyFile
那么我需要如何调整正则表达式来提取该字符串!
此致
汉内斯
#IfWinActive, ahk_class CabinetWClass ; explorer
F1:: MsgBox, % GetActiveExplorerPath()
; or
F2::
ActiveExplorerPath := GetActiveExplorerPath()
MsgBox, % ActiveExplorerPath
return
#IfWinActive
GetActiveExplorerPath() {
; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=69925
explorerHwnd := WinActive("ahk_class CabinetWClass")
if (explorerHwnd)
{
for window in ComObjCreate("Shell.Application").Windows
{
if (window.hwnd==explorerHwnd)
return window.Document.Folder.Self.Path
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)