Autohotkey: 활성 파일의 경로를 가져올 수 없습니다

Autohotkey: 활성 파일의 경로를 가져올 수 없습니다

활성 파일의 경로를 얻고 싶습니다.

활성 파일 경로: 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

관련 정보