Send-SignatureToClipBoard

PowerShell Team

In my previous blog about the Philosophy of Automation, I encouraged everyone to share their automation even when it was small.  Here I’ll follow that advice.

I find myself doing quite a bit of blogging and commenting on other people’s blogs.  I am often struck by the sorry state of blogging software.  I could go on for quite some time on that topic but the one thing I want to highlight is the issue of Signatures.  I have a signature that I use for all my entries.  I used to type it in each time but then I would get variations because I didn’t remember it quite right and it was a pain to type (BTW – Automation is not JUST about productivity – it is about QUALITY as well.  I should blog that at some point.)  Anyway, it didn’t take me long to put this into a file SIG.TXT that I would then “cat” in a PowerShell window and then cut-n-paste into the application. The problem is that I’m not a very good cut-n-paster and sometimes I vary the size of my PowerShell Window which caused wrapping so I would have to change the size of my window and cat the file again (and then change it back). 

It’s sad to admit how long I put up with this stupid workflow before I decided to automate it but now in my profile file I have the following:

function Send-SignatureToClipBoard
{
   cat c:\ps\Sig.txt |clip
}
Set-Alias snstc Send-SignatureToClipBoard

This sends my signature into the clipboard (I bet a $1 you could have guessed that 🙂 ) so that can paste it with ease.  Notice that I gave it a good descriptive name to help me remember it (“Send” is a common verb) and to make it self-documenating and then a pithy alias (“SN” is the recommended shortcut for “SEND” so it is it is very easy to remember, I think the sentence as I type “SeNd Signature To Clipboard” => SNSTC).

So this is a good example of a simple bit of automation that isn’t going to change the world but it does move the ball forward a bit.  I hope you find it useful.  If you found this useful, I’ve made my point and you should do the same.

Cheers!  (Time to switch to my PowerShell window to type SNSTC!)

Jeffrey Snover [MSFT]
Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Postscript:  It turns out that CLIP.EXE is only shipped with Vista (so upgrade today 🙂 ).  It turns out that that is a great thing because it should encourage you to download, use, participate-in the PowerShell Community Extensions Project.   It has an out-ClipBoard project which should work a treat for you! 

 

0 comments

Discussion is closed.

Feedback usabilla icon