beegod

ramblings from the hive mind

Working Well With Windows Users

22 April 2010 | View comments
Damien Austin-Walker

I have to work with people that use windows. There is no getting away from it. Not only that but I have to run their email systems.

One thing that really gets my goat is attaching files to an internal email when those files are available on a shared drive within the organization. I have spent years ranting on about this and in the last year I seem to be finally getting through to those I work with.

However I moved from using Windows to using Ubuntu Linux some time ago. So now while my windows using collegues have finally grasped sending round links to files rather than attaching them I cannot reciprocate easiy. The best I can do is copy the file path and paste it into the email. Ubuntu file paths have forward slashes / while windows has to be different and uses back slashes. My work mates therefore can only use my file locations as a guide to manually drill down the folder structure to the file rather than simply being able to click on the link.

Oh how they moan. And as I have spent years berating them for not using file links they also understandably tease a little. So I created a method to solve this problem.

My solution is to create a script that will replace forward slashes with back slashes change the beginning of my file paths from /home/damien/mount (where I mount the windows shared drives on my machine using cifs) to file:///\server-name\volume-name\drive-name so they become clickable links in Windows. Then run the script from a right click menu on selecting the file in question.

To add a menu item to the right click I install gnome-actions:

sudo apt-get install gnome-actions

To enable me to copy the modified file path to the clipboard install xclip:

sudo apt-get install xclip

Then I create the new menu item:

System > Preferences > Nautilus Actions Configuration

Click Add

Make a label which will appear in the menu. I named it “Create Win Link”

Choose a Tooltip and icon is you wish.

Add the path to your script, which we will create in a minute. mine is /home/damien/winlink

We want to pass the path to the selected file to the script so enter %M in the Parameters field.

The menu item is done. Now for the script.

Create the file:

nano /home/damien/winlink (in my case)

I am using {string//$match/$replacement} to replace ALL instances of match that occur in string with replacement

Note is you just want to replace the first occurance the syntax is {string/$match/$replacement} (note single forward slash after string). For more on string manipulation in bash have a look here.

I expect my code could be more concise but it does the job. To make it simpler I have only set this up for our main shared drive, it made the string substitutions easier for now.

Then copy the modified file path to the clip board using xclip:

echo ${MY_MODIFED_PATH} xclip -selection clipboard

Here is my final script:

! /bin/bash

match=’/’

repl=’'

match2=’/home/damien/mounts/Team_Drive/’

repl2=’file:///\server\volumelabel\Team%20Drive'

match3=’ ‘

repl3=’%20’

MY_PATH=”$1”

MY_PATH2=${MY_PATH//$match/$repl}

MY_PATH3=${MY_PATH//$match3/$repl3}

echo ${MY_PATH3//$match2/$repl2} xclip -selection clipboard

I can now right click any file on the shared drive and select Copy Win Link from the menu and simply paste it into an email.

People using Windows7 with Office/Outlook 2007 see this as a link in the received email which they can click on to open the original file. Unfortunately for those using Office/Outlook 2003 it does not appear as a link, however they can still copy and paste it into their file manager and it does the same thing. I will post back here if I find a fix for this in Outlook 2003

I can now follow my own best practice!



blog comments powered by Disqus