Permalink
Browse files

Windows support.

  • Loading branch information...
1 parent b750823 commit 0d0da185373c457707d7a826b1309725193e1246 @kennethreitz committed Sep 9, 2010
Showing with 35 additions and 0 deletions.
  1. +35 −0 xerox/win.py
View
@@ -0,0 +1,35 @@
+""" Copy + Paste in Windows
+"""
+
+# found @ http://code.activestate.com/recipes/150115/
+
+try:
+ import win32clipboard as w
+ import win32con
+except ImportError, why:
+ raise Pywin32NotFound
+
+
+def copy(string):
+ """Copy given string into system clipboard."""
+ try:
+ pass
+ except Exception, e:
+ raise e
+ w.OpenClipboard()
+ w.EmptyClipboard()
+ w.SetClipboardData(1, string)
+ w.CloseClipboard()
+
+def paste():
+ """Returns system clipboard contents."""
+ try:
+ pass
+ except Exception, e:
+ raise e
+ w.OpenClipboard()
+ d=w.GetClipboardData(win32con.CF_TEXT)
+ w.CloseClipboard()
+ return d
+
+

0 comments on commit 0d0da18

Please sign in to comment.