예제 #1
0
 def set_clipboard(content):
     # 打开剪切板
     wc.OpenClipboard()
     # 清空剪切板
     wc.EmptyClipboard()
     # 将数据astring写入剪切板
     wc.SetClipboardData(win32con.CF_UNICODETEXT, content)
     # 关闭剪切板
     wc.CloseClipboard()
예제 #2
0
파일: Main.py 프로젝트: eko234/Clippy
    def returnClipBoardValue(self, *args):
        try:
            win32clipboard.OpenClipboard()
            win32clipboard.EmptyClipboard()
            win32clipboard.SetClipboardData(1, self.text)
            win32clipboard.CloseClipboard()

        except:
            print "somer error at returnclipboardvalue"
예제 #3
0
 def setText(aString):
     #打开剪切板
     w.OpenClipboard()
     #清空剪切板
     w.EmptyClipboard()
     #将数据astring 写入剪切板
     w.SetClipboardData(win32con.CF_TEXT, aString)
     #关闭剪切板
     w.CloseClipboard()
 def set_text(value):
     """设置剪切板内容"""
     try:
         w.OpenClipboard()  # 打开剪切板
         w.EmptyClipboard()  # 清空剪切板
         w.SetClipboardData(win32con.CF_UNICODETEXT, value)  # 设置内容
         w.CloseClipboard()  # 关闭
     except Exception as e:
         raise e
예제 #5
0
def paste_into_clipboard_full():
    pic = ImageGrab.grab() # 同第13行
    ImageByte = BytesIO() # 创建BytesIO数据块
    pic.save(ImageByte, format = "BMP") # 保存入数据块
    ImageByte = ImageByte.getvalue()[14:] # 获得合法DIB截图数据
    win32clipboard.OpenClipboard() # 打开剪贴板
    win32clipboard.EmptyClipboard() # 清空剪贴板
    win32clipboard.SetClipboardData(win32clipboard.CF_DIB, ImageByte) # 设置剪贴板格式
    win32clipboard.CloseClipboard() # 关闭剪贴版
예제 #6
0
파일: win.py 프로젝트: startling/xerox
def copy(string):
    """Copy given string into system clipboard."""

    clip.OpenClipboard()
    clip.EmptyClipboard()
    clip.SetClipboardData(1, string)
    clip.CloseClipboard()

    return
예제 #7
0
def do_search():
    fen = get_fen()
    wc.OpenClipboard()
    wc.EmptyClipboard()
    wc.SetClipboardData(win32con.CF_UNICODETEXT, fen)
    wc.CloseClipboard()
    paste_fen()
    pyautogui.sleep(0.5)
    search()
예제 #8
0
 def copyLink(self):
     apply_link = "http://lbsyun.baidu.com/apiconsole/key"
     w.OpenClipboard()
     w.EmptyClipboard()
     w.SetClipboardData(win32con.CF_TEXT, apply_link)
     w.CloseClipboard()
     # QtGui.QMessageBox.information(self.iface.mainWindow(), u"成功", u"已复制链接!")
     self.iface.messageBar().pushMessage(u'复制成功', u'已复制链接到剪切板 ',
                                         QgsMessageBar.SUCCESS, 3)
예제 #9
0
파일: uploadfile.py 프로젝트: caixinshu/api
def setText(aString):
    board.OpenClipboard()
    board.EmptyClipboard()
    board.SetClipboardData(win32con.CF_TEXT, aString)
    board.CloseClipboard()


#setText("D:\ABC")
#print getText()
예제 #10
0
 def clicpBoard(self, text):
     time.sleep(self.TIME_SLEEP)
     # 打开粘贴板
     wincld.OpenClipboard()
     # 清空粘贴板
     wincld.EmptyClipboard()
     wincld.SetClipboardData(win32con.CF_UNICODETEXT, text)
     wincld.CloseClipboard()
     pass
예제 #11
0
 def saveToCut(self):
     output = BytesIO()  # BytesIO实现了在内存中读写bytes
     self.img.convert("RGB").save(output, "BMP")  #以RGB模式保存图像
     data = output.getvalue()[14:]
     clip.OpenClipboard()  #打开剪贴板
     clip.EmptyClipboard()  #先清空剪贴板
     clip.SetClipboardData(win32con.CF_DIB, data)  #将图片放入剪贴板
     clip.CloseClipboard()
     output.close()
예제 #12
0
 def copy_menuOnMenuSelection(self, event):
     self.info_text.SetValue(str_help)
     str_cb = self.dst_text.GetValue()
     w.OpenClipboard()
     w.EmptyClipboard()
     w.SetClipboardData(win32con.CF_UNICODETEXT, str_cb)
     w.CloseClipboard()
     self.info_text.SetValue("已复制到剪切板")
     event.Skip()
예제 #13
0
def setCopy(str):
    '''
    Set [str] to the clipboard
    - @str: Strint to be set in the clipboard
    '''
    wc.OpenClipboard()
    wc.EmptyClipboard()
    wc.SetClipboardData(win32con.CF_UNICODETEXT, str)
    wc.CloseClipboard()
예제 #14
0
def command_line_runner():
    parser = get_parser()
    args = vars(parser.parse_args())
    bs64code = transfor(addr=args["address"])
    _print(bs64code)
    w.OpenClipboard()
    w.EmptyClipboard()
    w.SetClipboardData(win32con.CF_TEXT, bs64code)
    w.CloseClipboard()
예제 #15
0
def send_image_to_clipboard(img):
	with BytesIO() as output:
		img.convert("RGBA").save(output, "BMP")
		data = output.getvalue()[14:]

	win32.OpenClipboard()
	win32.EmptyClipboard()
	win32.SetClipboardData(BMP_DATATYPE, data)
	win32.CloseClipboard()
예제 #16
0
def set_clipboard_text(text):
    u"""设置剪贴板内容"""
    try:
        win32clipboard.OpenClipboard()
        win32clipboard.EmptyClipboard()
        win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, text)
        win32clipboard.CloseClipboard()
    except Exception, e:
        raise e
예제 #17
0
def win_clip(my_str=''):
    '''
    Copy the string to the windows clipboard.
    my_str : string
    '''
    win32clipboard.OpenClipboard()
    win32clipboard.EmptyClipboard()
    win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, my_str)
    win32clipboard.CloseClipboard()
예제 #18
0
파일: win.py 프로젝트: tarruda/xerox
def copy(string):
    """Copy given string into system clipboard."""

    clip.OpenClipboard()
    clip.EmptyClipboard()
    clip.SetClipboardData(win32con.CF_UNICODETEXT, string)
    clip.CloseClipboard()

    return
예제 #19
0
파일: __init__.py 프로젝트: insequor/pepper
def putInClipboard(text):
    '''
    Put the text to the clipboard. This should be extended to support
    other formats
    '''
    clipboard.OpenClipboard()
    clipboard.EmptyClipboard()
    clipboard.SetClipboardData(win32con.CF_UNICODETEXT, unicode(text))
    clipboard.CloseClipboard()
예제 #20
0
 def textToClipboard(self):
     if self.result:
         win32clipboard.OpenClipboard()
         win32clipboard.EmptyClipboard()
         win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT,
                                         self.result)
         win32clipboard.CloseClipboard()
     else:
         raise OCRFailed
예제 #21
0
def handle_key():
    global Lmenu_press
    if(Lmenu_press):
        wincld.OpenClipboard()
        wincld.EmptyClipboard()
        wincld.SetClipboardData(win32con.CF_UNICODETEXT, getText())
        print(getText())
        wincld.CloseClipboard()
        Lmenu_press = False
예제 #22
0
def Twitter_img_save():
	aString=windll.user32.LoadImageW(0,"save.bmp",win32con.IMAGE_BITMAP,0,0,win32con.LR_LOADFROMFILE)	#解析图片到剪切板
	if aString !=0: 
		win32clipboard.OpenClipboard()
		win32clipboard.EmptyClipboard()
		win32clipboard.SetClipboardData(win32con.CF_BITMAP, aString)
		win32clipboard.CloseClipboard()
	else:
		print("图片编码格式解析失败")
예제 #23
0
    def copy_to_system(self, clear=True):
        with win32_clipboard_ctx():
            # Clear the system clipboard, if requested.
            if clear:
                win32clipboard.EmptyClipboard()

            # Transfer content to Windows system clipboard.
            for format, content in self._contents.items():
                win32clipboard.SetClipboardData(format, content)
예제 #24
0
def get_files_by_clipboard():
    global clipboard_open, keyboard, mouse_left_down_pos, is_mouse_left_down, mouse, hm, screen_bound_ui
    files = None
    try:
        while clipboard_open:
            pass
        winclip.OpenClipboard()
        clipboard_open = True
        bak_fmt = winclip.EnumClipboardFormats()
        bak_data = winclip.GetClipboardData(bak_fmt)
        # mimic ctrl-c
        #if winclip.EnumClipboardFormats() == 13:
        #    print "before sleep, copy data:"+winclip.GetClipboardData(winclip.CF_TEXT)+"dataend"
        #print str(mouse_left_down_pos)
        mouse.release(mouse_left_down_pos[0], mouse_left_down_pos[1], 1)
        is_mouse_left_down = False
        #print "first sleep over"
        #winclip.EmptyClipboard()
        #winclip.SetClipboardData(win32con.CF_TEXT, "setfordetectformatschangelater")

        winclip.CloseClipboard()
        clipboard_open = False

        # hide pointer
        # don't use mouse_pos_hide, since it's used in Hook
        mouse.move(screen_bound_ui[0], screen_bound_ui[1] / 2)
        # TODO: get mouse position by hook now as mouse_pos_hide
        # Hook mouse
        hm.MouseMove = on_mouse_move
        # should be with hm.KeyUp = ... logically, but put here to give user a quick feed back that entered other screen
        # while localhost can continue its clipboard operations

        # TODO: not so graceful hear (time.sleep)
        time.sleep(0.2)
        #keyboard.tap_key(40)
        keyboard.press_key(162)  # ctrl
        keyboard.press_key(67)  # c
        keyboard.release_key(67)  # c
        keyboard.release_key(162)  # ctrl
        time.sleep(0.2)
        # TODO: how to detect clipboard open ? then i can check whether the ctrl-c had been pressed successfully
        while clipboard_open:
            pass
        winclip.OpenClipboard()
        clipboard_open = True

        #if winclip.EnumClipboardFormats() == 13 or winclip.EnumClipboardFormats() == 1:
        #    print "copy data:"+winclip.GetClipboardData(winclip.CF_TEXT)+"dataend"
        #print hex(winclip.EnumClipboardFormats())
        files = winclip.GetClipboardData(winclip.CF_HDROP)
        winclip.SetClipboardData(bak_fmt, bak_data)
    except Exception as e:
        print e
    finally:
        winclip.CloseClipboard()
        clipboard_open = False
    return files
예제 #25
0
 def setCopyText(self, text):
     '''
     向剪切板中添加数据
     '''
     log.log("写入剪切板内容:" + text)
     win32clipboard.OpenClipboard()
     win32clipboard.EmptyClipboard()
     win32clipboard.SetClipboardData(win32con.CF_TEXT, text)
     win32clipboard.CloseClipboard()
예제 #26
0
 def setText(aString):
     #打开剪贴板
     w.OpenClipboard()
     #清空剪贴板
     w.EmptyClipboard()
     #将数据aString写入剪贴板
     w.SetClipboardData(win32con.CF_UNICODETEXT, aString)
     #关闭剪贴板
     w.CloseClipboard()
예제 #27
0
def setClipboard(aString):
    '设置剪切板中的数据'
    import win32clipboard as w
    import win32con
    w.OpenClipboard()
    w.EmptyClipboard()
    w.SetClipboardData(win32con.CF_UNICODETEXT, aString)
    w.CloseClipboard()
    return aString
예제 #28
0
def win_set_pastebuffer(msg, aType=None):
    import win32clipboard as w
    import win32con
    if aType is None:
        aType = win32con.CF_TEXT
    w.OpenClipboard()
    w.EmptyClipboard()
    w.SetClipboardData(aType, msg)
    w.CloseClipboard()
예제 #29
0
def send_to_clipboard(image):
    output = BytesIO()
    image.convert('RGB').save(output, 'BMP')
    data = output.getvalue()[14:]
    output.close()

    win32clipboard.OpenClipboard()
    win32clipboard.EmptyClipboard()
    win32clipboard.SetClipboardData(win32clipboard.CF_DIB, data)
    win32clipboard.CloseClipboard()
예제 #30
0
    def writer_into(self):
        index = self.frame.m_listBox_deffer.GetSelection()

        info = self._new_add[index]

        win32clipboard.OpenClipboard()

        win32clipboard.EmptyClipboard()
        win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, info)
        win32clipboard.CloseClipboard()