header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

remove HTML from get-clipboard
Last Post 06 May 2008 03:37 PM by johndcook. 7 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
johndcookUser is Offline
New Member
New Member
Posts:7

--
06 May 2008 02:10 AM  

When you select formatted text to the clipboard then use the PSCX cmdlet get-clipboard, there's a lot of HTML formatting. How do you strip that out? I thought the -text switch might cause get-clipboard to get the clipboard contents as text, but apparently that's not what the switch is for.

I could write my own code to strip out the HTML formatting, but I have the feeling such brute force isn't necessary. Is there an easier way?

Thanks.

John

 



halr9000User is Offline
Basic Member
Basic Member
Posts:303

--
06 May 2008 02:41 AM  
Running "get-clipboard -?" shows me that there is a -text parameter. Try that and see what happens. I imagine the source data is in a rich text or web control so the fact that it contains HTML would not be surprising. Let us know if this works.


johndcookUser is Offline
New Member
New Member
Posts:7

--
06 May 2008 02:48 AM  
Thanks, but the -text switch doesn't work. Maybe I'm not using it correctly. I can't see that -text has any effect.


halr9000User is Offline
Basic Member
Basic Member
Posts:303

--
06 May 2008 03:04 AM  
What application are you copying from?


johndcookUser is Offline
New Member
New Member
Posts:7

--
06 May 2008 03:10 AM  
I've tried Excel, Word, and IE. They all produce a huge amount of HTML fluff.


halr9000User is Offline
Basic Member
Basic Member
Posts:303

--
06 May 2008 03:40 AM  
Hrm. I'm using Office 2007 with PowerShell CTP v2 (a beta of sorts) and cannot reproduce your issue. If we can't figure it out after a bit I'll contact the lead PSCX guy and tell him to get his butt in here.


johndcookUser is Offline
New Member
New Member
Posts:7

--
06 May 2008 10:44 AM  

The attachment has more details, exactly what I copied and exactly what get-clipboard produced.


Attachment: 156444457871.zip

johndcookUser is Offline
New Member
New Member
Posts:7

--
06 May 2008 03:37 PM  

The attached file contains more details: my configuration, exactly what I copied, what get-clipboard returned, etc.

Here's a sample of the kind of output I'm talking about:

Version:1.0
StartHTML:0000000105
EndHTML:0000001995
StartFragment:0000001570
EndFragment:0000001943
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
...
 

 


Attachment: 15638585971.zip

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer