Send-SignatureToClipBoard

Send-SignatureToClipBoard

  • Comments 11

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! 

 

Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post
  • Hi people!

    Christmas Day falls on December 25. It is preceded by Christmas Eve on December 24, and in some countries is followed by Boxing Day on December 26. Some Eastern Orthodox Churches celebrate Christmas on January 7, which corresponds to December 25 on the Julian calendar. December 25 as a birthdate for Jesus is merely traditional, and is not thought to be his actual date of birth.Good luck!

  • So, what is 'clip'?  An alias to something else?

  • > So, what is 'clip'?  An alias to something else?

    PS> dir (gcm clip).Definition |fl *

    PSPath            : Microsoft.PowerShell.Core\FileSystem::C:\Windows\system32\clip.exe

    PSParentPath      : Microsoft.PowerShell.Core\FileSystem::C:\Windows\system32

    PSChildName       : clip.exe

    PSDrive           : C

    PSProvider        : Microsoft.PowerShell.Core\FileSystem

    PSIsContainer     : False

    Mode              : -a---

    EXIF              :

    Basename          :

    VersionInfo       : File:             C:\Windows\system32\clip.exe

                       InternalName:     clip.exe

                       OriginalFilename: clip.exe.mui

                       FileVersion:      6.0.6000.16386 (vista_rtm.061101-2205)

                       FileDescription:  Clip - copies the data into clipboard

                       Product:          Microsoftr Windowsr Operating System

                       ProductVersion:   6.0.6000.16386

                       Debug:            False

                       Patched:          False

                       PreRelease:       False

                       PrivateBuild:     False

                       SpecialBuild:     False

                       Language:         English (United States)

    Name              : clip.exe

    Length            : 26624

    DirectoryName     : C:\Windows\system32

    Directory         : C:\Windows\system32

    IsReadOnly        : False

    Exists            : True

    FullName          : C:\Windows\system32\clip.exe

    Extension         : .exe

    CreationTime      : 11/2/2006 12:32:38 AM

    CreationTimeUtc   : 11/2/2006 8:32:38 AM

    LastAccessTime    : 11/7/2006 12:59:41 PM

    LastAccessTimeUtc : 11/7/2006 8:59:41 PM

    LastWriteTime     : 11/2/2006 1:44:58 AM

    LastWriteTimeUtc  : 11/2/2006 9:44:58 AM

    Attributes        : Archive

    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

  • Is this a Vista thing? "clip.exe" is present on neither my Windows XP Pro machine nor my Windows XP Media Center Edition machine.

  • > Is this a Vista thing? "clip.exe" is present on neither my Windows XP Pro machine nor my Windows XP Media Center Edition machine.

    Apparently it is.  This is a good time to put in a plug for the PowerShell Community eXtensions project at:

    http://www.codeplex.com/Wiki/View.aspx?ProjectName=PowerShellCX

    It has an out-Clipboard which should work a treat.

    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

  • Yep - I wrote the FeedStoreProvider for PsCx ;)

    I was wondering whether all that work the guys put into out-clipboard was a waste! Turns out it wasn't! :)

  • One of the things that motivated us to develop PowerShell was the belief that we (Microsoft) had been

  • Yes, "upgrade today" to Windows Vista, so you can have access to clip.exe... but not to PowerShell! ;-) Well, still as of January 15th anyway... tick tock...

  • Clip.exe was also a part of the Windows NT4 and Windows 2000 Server Resource Kit. You'll find it there. The Win2000 version works fine in XP. :-)

    VidarT

  • The latest clip.exe is on Server 2003 and can be copied to XP.

    For signatures (as many as you like for different situations) or any other strings you use regularly, it's hard to go past "Keyboard Express" - http://KeyboardExpress.com.

    I could no longer live without it. I even have blocks of frequently used ASP and Javascript, pseudo-Latin filler text, etc. all just a key combo away. Highly recommended.

    - Bill

  • see also

    http://download.flamework.net/Use-Clipboard.ps1

    http://flamework.net/archives/tag/%e3%82%af%e3%83%aa%e3%83%83%e3%83%97%e3%83%9c%e3%83%bc%e3%83%89

Page 1 of 1 (11 items)