def set_clipboard(content): # 打开剪切板 wc.OpenClipboard() # 清空剪切板 wc.EmptyClipboard() # 将数据astring写入剪切板 wc.SetClipboardData(win32con.CF_UNICODETEXT, content) # 关闭剪切板 wc.CloseClipboard()
def returnClipBoardValue(self, *args): try: win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(1, self.text) win32clipboard.CloseClipboard() except: print "somer error at returnclipboardvalue"
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
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() # 关闭剪贴版
def copy(string): """Copy given string into system clipboard.""" clip.OpenClipboard() clip.EmptyClipboard() clip.SetClipboardData(1, string) clip.CloseClipboard() return
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()
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)
def setText(aString): board.OpenClipboard() board.EmptyClipboard() board.SetClipboardData(win32con.CF_TEXT, aString) board.CloseClipboard() #setText("D:\ABC") #print getText()
def clicpBoard(self, text): time.sleep(self.TIME_SLEEP) # 打开粘贴板 wincld.OpenClipboard() # 清空粘贴板 wincld.EmptyClipboard() wincld.SetClipboardData(win32con.CF_UNICODETEXT, text) wincld.CloseClipboard() pass
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()
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()
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()
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()
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()
def set_clipboard_text(text): u"""设置剪贴板内容""" try: win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, text) win32clipboard.CloseClipboard() except Exception, e: raise e
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()
def copy(string): """Copy given string into system clipboard.""" clip.OpenClipboard() clip.EmptyClipboard() clip.SetClipboardData(win32con.CF_UNICODETEXT, string) clip.CloseClipboard() return
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()
def textToClipboard(self): if self.result: win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, self.result) win32clipboard.CloseClipboard() else: raise OCRFailed
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
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("图片编码格式解析失败")
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)
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
def setCopyText(self, text): ''' 向剪切板中添加数据 ''' log.log("写入剪切板内容:" + text) win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(win32con.CF_TEXT, text) win32clipboard.CloseClipboard()
def setText(aString): #打开剪贴板 w.OpenClipboard() #清空剪贴板 w.EmptyClipboard() #将数据aString写入剪贴板 w.SetClipboardData(win32con.CF_UNICODETEXT, aString) #关闭剪贴板 w.CloseClipboard()
def setClipboard(aString): '设置剪切板中的数据' import win32clipboard as w import win32con w.OpenClipboard() w.EmptyClipboard() w.SetClipboardData(win32con.CF_UNICODETEXT, aString) w.CloseClipboard() return aString
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()
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()
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()