OSX service to rewrite my intranet links
At the office we have a mixed Windows/OSX environment.
There is also a shared network storage with multiple mount points. In Windows, a link to a file on the server, will look like
N:\TempFiles\company\project\ while on a Mac, the same link will look something like
/Volumes/TempFiles/company/project/. So when a colleague send me the link to his latest presentation from Windows, I have to manually follow the path.
That's why I wrote a simple OS X service that does that automatically. I just copy (cmd-C) the link (or part of it), then press cmd-Y (by default it's assigned to "create new note", I don't use notes)
- From Automator, I created a new service. Options: "no input", "any application"
- I selected "Run shell script'
- Added the following code to the script
f="$(pbpaste | sed -e 's/N:/\/Volumes/g' | sed -e 's/\/\//g')" open "$f"
- Saved the service with a new name (ex. "openWinLinks")
- From System Preferences -> Keyboard -> Keyboard Shortcuts I assigned CMD-Y to run my script.