Would like tilde ( ~ ) copied/pasted instead of the home folder name when i copy a file path with KM

Catalina / Finder: is there any way to configure Finder or the Mac Os so that a tilde ( ~ ) is copied/pasted instead of the home folder name when i copy a file path with KM?
thank you

3 Likes

great ! thanks very much. Would you happen to know if the is a setting in Finder or Pathfinder to do the same ? thank you

Not that I'm aware of. There's API for it which you can use from osascript (AppleScript / JavaScript), FWIW.

e.g.

Expand disclosure triangle to view JS Source

ObjC.unwrap($(strPath).stringByAbbreviatingWithTildeInPath)

// and, dually:

// filePath :: String -> FilePath
const filePath = s =>
    // The given file path with any tilde expanded
    // to the full user directory path.
    ObjC.unwrap(
        ObjC.wrap(s).stringByStandardizingPath
    );
1 Like

OK thanks again

Once you have made your Keyboard Maestro Macro to copy the selected Finder Item as tide (~) abbreviated you can add it as a Quick Action to the Finder's context menu:

File>Export>Export as Quick Action...

This makes it available in the Finder's context menu without needing to remember a shortcut.

KM Path as Tilde.kmmacros (16.5 KB)

Click to Show Image of Macro

3 Likes

@ComplexPoint @Zabobon
I will certainly do it. thanks very much. I am sure that many many users and people in general use text transformations regularly, and am surprised that I have to take time to complete this macro. I would think that most forum members have some kind of handy tool on hand for that purpose.
thank you both for your help