More colour syntax highlights
In this post - http://richardsiddaway.spaces.live.com/default.aspx?_c01_BlogPart=blogentry&_c=BlogPart&handle=cns!43CFA46A74CF3E96!2025 – I mentioned I had been experimenting with the copy script functionality so that I would get colour copy\paste from PowerShell ISE. There was a problem in that I couldn’t paste into Live Writer – it crashed.
Lee Holmes has re-written the script -http://www.leeholmes.com/blog/MorePowerShellSyntaxHighlighting.aspx
One slight issue is that you need to create a profile for ISE – called Microsoft.PowershellISE_profile.ps1. It goes in the WindowsPowerShell folder in the Documents folder of your profile.
In that profile you need the line
| 001 002
| ## add the copy-script function $psise.CustomMenu.Submenus.Add("Copy Script", {C:\Scripts\ISE\copy-script.ps1}, "Shift+Ctrl+Z") |
This will add the script onto the custom menu in ISE.
When you come to paste into Live Writer – use Edit – Paste Special – Keep Formatting to get the colour syntax highlights. Notice in this version that you get line numbers as well. This will be useful for writing about the scripts
This seems to work OK – I’ll experiment so more and report back.

Read the complete post at http://richardsiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!2075.entry