Convert pathname

I have the only Mac in a PC office. When I receive a work email with a link to a file on the company network, the Mac does not recognize the "/" in the file pathname, so I cannot open the file by following the link.

I'd like to create a "convert PC pathname to Mac pathname" KM shortcut that will swap out "/" with "" and open the file.

Ideally, I would have the cursor to the link, type the trigger, and have the file automatically open.

Any suggestion? Thank you.

Response to these things is always delayed by the absence of a before and after example.

i.e. you always need:

  • a sample of input, with
  • a sample of the corresponding output that you want.

If you were just looking to replace file:/// with file://, for example, then a search and replace action should be enough.


Tip: How Do I Get The Best Answer in the Shortest Time? - Tips & Tutorials - Keyboard Maestro Discourse

I'm guessing you've got you slash direction wrong, and they're sending out

\TheServer\TheShare\Path\To\The\File.txt

...which you want to convert to a Mac-compatible format. Are you happy to just pop the folder up in the Finder and open the file yourself?

If you don't want to select the path manually then trigger the macro -- what's the email program? (I'm not saying that this can be done based solely on the insertion point, just that it might be doable.)

Ugh, yes, I gave the wrong slashes. Thank you for picking up on that.

Ideally, the trigger would open the file, but opening the folder containing the file is a sound alternative.

Re. the email app: I’m using Outlook.

Thank you for your interest.

Regards,
-- Todd

Here's a basic version to get you started -- change the hotkey trigger to suit.

Select the PC file path in Outlook, trigger the macro, and the Finder will (eventually) open the server directory with the file selected ready for you to open.

Three annoyances -- you have to manually select the text, it doesn't open the file, and it'll mount a new volume every time even if the share is already mounted. Consider it a temporary placeholder, pending a proper version using AppleScript...

Basic Open PC File Link From Selected Text copy.kmmacros (3.0 KB)

Summary