Extending @Farrel code a little (thanks a lot!), Here is my AutoHotkey script, which will get the full path to the file for any selected file, and then (if desired) will change the slashes for better use in R.
The script also replaces all mapped drives with the full network path. To use this, you need to edit this script to find your specific mapped drives, and then replace these drive letters with the full path.
It took a bit to set up, but it is so useful. I use it every day.
;If Windows explorer is active...
; ALT + F - Get the filepath to the file
!f::
SendInput, ^c
Sleep 100
Clipboard := Clipboard
return
;Check for and replace mapped drive names on the clipboard with full file paths
If InStr(Clipboard,"X:\",1) {
Clipboard := "\\SERVER_NAME\g$\" SubStr(Clipboard,4, (StrLen(Clipboard )))
} else if InStr(Clipboard,"K:\",1) {
Clipboard := "\\SERVER_NAME\Data\" SubStr(Clipboard,4, (StrLen(Clipboard )))
} else if InStr(Clipboard,"Q:\",1) {
Clipboard := "\\SERVER_NAME\Data\" SubStr(Clipboard,4, (StrLen(Clipboard )))
} else if InStr(Clipboard,"L:\",1) {
Clipboard := "\\SERVER_NAME\" SubStr(Clipboard,4, (StrLen(Clipboard )))
}
Return
; ALT + S - Replaces backslashes with forward slashes (helpful for R)
; Source: https://stackoverflow.com/questions/1407238/relief-from-backslash-irritation-in-r-for-windows
!s::
StringReplace,clipboard,clipboard,\,/,All
send %clipboard%
return
; Scripts below this point will run in any active window
#IfWinActive
source
share