
Я хочу получить путь к активному файлу.
активный путь к файлу: C:\Users\e\Desktop\1w.jpg"
результат автохоткея: C:\Windows\System32\dllhost.exe
код:
q::
WinGet, Path, ProcessPath, A
MsgBox, %Path%
решение1
Получить путь к текущему активному скрипту:
F1::MsgBox, "%A_ScriptFullPath%"
https://www.autohotkey.com/docs/Variables.htm#prop
Получите путь к активному файлу в средстве просмотра фотографий Windows или в Potplayer:
; Get the path of the recent items folder
RegRead, Recent, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, Recent
F2::
WinGetActiveTitle, active_title
active_title := StrSplit(active_title," - Windows Photo Viewer").1
active_title := StrSplit(active_title," - PotPlayer").1
If FileExist(Recent "\" active_title ".lnk")
{
FileGetShortcut, %Recent%\%active_title%.lnk, path
MsgBox, "%path%"
}
else
MsgBox, path not found
return
https://www.autohotkey.com/docs/commands/FileGetShortcut.htm