How to? Screen capture with color

samintz

Scott Mintz
May 20, 2008
1,295
11
Solon, OH, USA
#1
Someone at some point in the past used to do screen captures with either ANSI or RTF/HTML codes to capture not only the text but the colors as well.

Was that a plugin or external tool? How can I do that? I don't want a Print-Screen graphic.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,650
46
Albuquerque, NM
prospero.unm.edu
#4
Sounds like it might be a fun project. It would probably be a different plugin, though.

(What are you trying to do? If you want to save the console buffer and restore it later, Vincent and I both have plugins to do that.)
 
Jan 19, 2011
581
10
Norman, OK
#6
@samintz could you demonstrate some RTF color pasting? Here's a sample screenshot from Word.

upload_2017-1-5_9-57-53.png

Here's the same text copied and pasted from Word. It keeps the formatting, but no colors.

Normal. Bold. Italics. Underlined. Highlighted. Red. Yellow. Blue.
 
#8
This page is mildly interesting.
[title]
If Winword uses RTF, it would seem Winword registered it. It'd be no surprise then if Outlook also registered it. Can you copy from Winword and paste to a non-Office app?
This page is also interesting.
https://support.microsoft.com/en-us/kb/258513
It gives an example from VB.
The hard part might well be turning the selection into RTF in the first place.
 
Jan 19, 2011
581
10
Norman, OK
#9
Yeah, it works pasting into Word/Outlook. I tinkered a little with the Charles' HTMLDUMP and it does a good job. I've used it in the past to make documentation from command line help and wrote a BTM file (call all the help commands into the console) and a couple of SED scripts to clean up the HTML output from it.

This is a raw paste from either's HTML output or directly from the console.

Code:
   prints the supplied string to terminal, which may contain color patterns:

      [Red],[Green],[Blue],[Yellow],[Cyan],[Magenta]   (bright)
      [red],[green],[blue],[yellow],[cyan],[magenta]   (dark)
        print the following text in the selected color.

      [def]
        switch back to default color.
The original console HTMLDUMP output pastes without the finer coloring (top), however, after I ran it through my routine (bottom) it displays nicely.

upload_2017-1-5_14-30-18.png
 

samintz

Scott Mintz
May 20, 2008
1,295
11
Solon, OH, USA
#10
HTMLDUMP does what I want with the caveat that it captures the entire console buffer. I want to select text with my mouse and copy it.

I'm not opposed to a TCMD-only solution. HTMLDUMP works in both TCC and TCMD.
 

samintz

Scott Mintz
May 20, 2008
1,295
11
Solon, OH, USA
#13
I just tried your tool. If I redirect the output to CLIP: and paste the result I get raw HTML. If I send the output to a file an open the file in Chrome it renders as formatted text. If I copy *that* text the clipboard contains a new entry type. I assume 0xC11E is CF_HTML.
Code:
Clipboard Open
There are 5 clipboard formats.
9438 (0xC11E) - UNKNOWN
  13 (0x0D) - CF_UNICODETEXT
  16 (0x10) - CF_LOCALE
   1 (0x01) - CF_TEXT
   7 (0x07) - CF_OEMTEXT
Clipboard Closed
This MSDN arfticle describes the CF_HTML clipboard format: [HTML Clipboard Format]
 

samintz

Scott Mintz
May 20, 2008
1,295
11
Solon, OH, USA
#14
Internet Explorer 11 puts even more into the clipboard:
Code:
Clipboard Open
There are 9 clipboard formats.
49161 (0xC009) - DATAOBJECT
    1 (0x0001) - CF_TEXT
   13 (0x000D) - CF_UNICODETEXT
49438 (0xC11E) - CF_HTML
49313 (0xC0A1) - UNKNOWN
50038 (0xC376) - UNKNOWN
49171 (0xC013) - Ole Private Data
   16 (0x0010) - CF_LOCALE
    7 (0x0007) - CF_OEMTEXT
Clipboard Closed