setting the clipboard

Brett g Porter BgPorter at
Tue Oct 30 03:49:58 CET 2001

"Peoter Veliki" <peoter_veliki at> wrote in message
news:6hnD7.320$MT2.19293225 at
> I see there is a setClipboardText, but there is no getClipboardText.  How
> can this be done using getClipboardData?
Here's a small script that gets whatever text is on the clipboard and uses
it to do a google query (I've got it aliased to WindowsKey+G -- very handy!)

import os
import urllib
import win32clipboard as clip

if clip.IsClipboardFormatAvailable(clip.CF_TEXT):
   newText = clip.GetClipboardData(clip.CF_TEXT)
   # format the query string, escaping out any URL-unsafe characters.
   urlString = '"%s"' % urllib.quote(newText)
   # ...this will launch the default browser on the search.

More information about the Python-list mailing list