Autohotkey: I can't get the path of the active file
i want to get path of active file.
active file path: C:\Users\e\Desktop\1w.jpg"
autohotkey result: C:\Windows\System32\dllhost.exe
code:
q::
WinGet, Path, ProcessPath, A
MsgBox, %Path%
Get the path of the current active script:
F1::MsgBox, "%A_ScriptFullPath%"
https://www.autohotkey.com/docs/Variables.htm#prop
Get the path of the active file in windows photo viewer or in 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