Extracting Rich Text data formats from win32clipboard

Neil Hodgson nhodgson at bigpond.net.au
Tue Aug 26 13:17:43 CEST 2003


Trader:
> >>> clipboard_grab()
> FORMAT: 49171
> FORMAT: 16
> FORMAT: 7
> FORMAT: 0

Now add in:

for f in formats:
    if f >= 0xC000:
        print win32clipboard.GetClipboardFormatName(f)

Formats above 0xC000 are dynamically registered clipboard types. I get:

FORMAT: 13
FORMAT: 49278
FORMAT: 49245
FORMAT: 49171
FORMAT: 16
FORMAT: 7
FORMAT: 0

HTML Format
Rich Text Format
Ole Private Data

The HTML has a prologue and then some HTML:

Version:1.0
StartHTML:000000195
EndHTML:000001891
StartFragment:000001597
EndFragment:000001710
StartSelection:000001597
EndSelection:000001710
SourceURL:http://sydney.citysearch.com.au/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>CitySearch.com.au Australia - Your guide to the city of
Sydney</TITLE>
...

The RTF looks normal:

{\rtf1\ansi\ansicpg-1\deff0\deflang3081{\fonttbl{\f0\froman\fcharset0 Times
New Roman;}{\f1\ftech\fcharset0 Symbol;}{\f2\fswiss\fcharset0
Arial;}{\f3\fswiss\fcharset0 Courier New;}{\f4\ftech\fcharset0
Wingdings;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green255
\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\r
ed255\green255\blue0;\red255\green255\blue255;\
...

   Neil






More information about the Python-list mailing list