【发布时间】:2018-04-22 13:53:37
【问题描述】:
欢迎大家
以下代码来自这里:https://autohotkey.com/boards/viewtopic.php?f=5&t=44848
作者:奥德兰尼尔
q::
fileselected := Explorer_GetSelection()
SplitPath,fileselected, fn
MsgBox % "FileName :`t" fn "`nFullName :`t" fileselected
clipboard = % "FileName :`t" fn "`nFullName :`t" fileselected
return
Explorer_GetSelection(hwnd="") {
WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (process = "explorer.exe")
if (class ~= "Progman|WorkerW") {
ControlGet, files, List, Selected Col1, SysListView321, ahk_class %class%
Loop, Parse, files, `n, `r
ToReturn .= A_Desktop "\" A_LoopField "`n"
} else if (class ~= "(Cabinet|Explore)WClass") {
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
sel := window.Document.SelectedItems
for item in sel
ToReturn .= item.path "`n"
}
return Trim(ToReturn,"`n")
}
return
当您单击热键时,我们会获得所选文件的文件名和路径, 如图所示
https://drive.google.com/open?id=1VvPKYrbVQEfrmdB34dUND9HbnXMl0Lr2
我的问题是:如何仅按文件名获取列表,没有文件路径和文件扩展名 如图所示
https://drive.google.com/open?id=1rCuLikjqT8Nudipby5Y9MOHTqdozGPYn
任何帮助将不胜感激。
【问题讨论】:
-
任何帮助请
标签: loops parameters path copy autohotkey