Python + Win32: Cut/Paste w/o GUI

Roger Upole rupole at hotmail.com
Sat Oct 5 10:59:14 EDT 2002


You can grab the clipboard text using the win32clipboard module.

import win32clipboard
win32clipboard.OpenClipboard()
print win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()

It won't really be copy'n'paste, but all you would have to do is copy the
text you need and double-click the script, which can then do whatever it
wants with the text.  If you really wanted it to look like a Paste, you
could
add a Paste action the the .py filetype.
          Roger

"Tim Daneliuk" <tundra at tundraware.com> wrote in message
news:5dukna.oh1.ln at boundary.tundraware.com...
> Disclaimer:  I'm *much* more comfortable with Unix innards than Win32, so
if
> the question I am about to ask is stoopid, please bear with me...
>
>
> I want to be able to do the following but am unclear if/how it can be
done:
>
> 1) Write a non-GUI Python script.
>
> 2) Create a shortcut in Win32 to that script.
>
> 3) Copy text from an arbitrary Win32 application.
>
> 4) Paste the copied text to the aforementioned shortcut/python script and
>     have that pasted text be somehow available (argv[] ???) for use by
that
>     script.
>
> Can this be done?
> --
> --------------------------------------------------------------------------
----
> Tim Daneliuk
> tundra at tundraware.com
>




-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----



More information about the Python-list mailing list