Search code examples
autohotkeyfilepathcapturewindows-explorerfile-properties

For Experts, Capture the full path of the file in Windows Explorer


Terminated for not being clear question? So as I have an answer?

Need Clicking the Left Mouse Button on a file in Windows Explorer, and you receive a message with the full file path.

Example: If I click the mouse on the file win.ini Displays the MsgBox: c:\windows\win.ini

OBS: Please, I need answers ready with examples, because my English is horrible and I am new to programming.


Solution

  • You could use something like this:

    ^LButton::
        ; Select the file underneath the cursor
        Click
        ; Save whatever was in the clipboard
        t := Clipboard
        ; Copy the selected file
        Send, ^c
        ; Store the path
        path := Clipboard
        ; Restore the previous clipboard
        Clipboard := t
        ; Display the path
        msgBox % path
    return
    

    I've bound it to Ctrl+Left Mouse Button since binding it to the Left Mouse Button would trigger it all the time.

    It should be noted though that you can do this in Windows already, just Shift+Right Click the file and select "Copy as path".