Autohotkey: no puedo obtener la ruta del archivo activo

Autohotkey: no puedo obtener la ruta del archivo activo

Quiero obtener la ruta del archivo activo.

ruta del archivo activo: C:\Usuarios\e\Escritorio\1w.jpg"

resultado de la tecla de acceso automático: C:\Windows\System32\dllhost.exe

código:

q::
WinGet, Path, ProcessPath, A
MsgBox, %Path%

Respuesta1

Obtenga la ruta del script activo actual:

F1::MsgBox, "%A_ScriptFullPath%"

https://www.autohotkey.com/docs/Variables.htm#prop

Obtenga la ruta del archivo activo en el visor de fotos de Windows o en 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

información relacionada