vrypan — panayotis vryonis
My blog is a digital scrapbook of ideas, thoughts and personal events. My home is vrypan.net.
Home — Archive: All · English · Greek — RSS Feeds: full feed · other options
#code-samples #en

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)

  1. From Automator, I created a new service. Options: "no input", "any application"
  2. I selected "Run shell script'
  3. Added the following code to the script f="$(pbpaste | sed -e 's/N:/\/Volumes/g' | sed -e 's/\/\//g')" open "$f"
  4. Saved the service with a new name (ex. "openWinLinks")
  5. From System Preferences -> Keyboard -> Keyboard Shortcuts I assigned CMD-Y to run my script.

Done. :-)

Share this post:
The Letter is a newsletter I send out whenever I have something to say or share. It may take a few days, weeks or months for the next one.
Privacy: I hate spam as much as you do, maybe more. I will not share your email with advertisers, etc.