# -*- coding: utf-8 -*- #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2006-2010 NVDA Contributors #This file is covered by the GNU General Public License. #See the file COPYING for more details. # NVDA Global Plugin # "%USERPROFILE%\Application Data\nvda\globalPlugins\ClipboardReader.py" # by Masatataka Shinke import ui import time import threading import win32clipboard from ctypes import * import globalPluginHandler # nvda import winUser # nvda keybd_event = windll.user32.keybd_event KEYEVENTF_KEYDOWN = 0 KEYEVENTF_EXTENDEDKEY = 1 KEYEVENTF_KEYUP = 2 # スレッド処理 class thread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): time.sleep(0.01) try: win32clipboard.OpenClipboard() ui.message(unicode(win32clipboard.GetClipboardData(1), "cp932")) win32clipboard.CloseClipboard() except: pass # プラグイン処理 class GlobalPlugin(globalPluginHandler.GlobalPlugin): def script_cKey(self,gesture): try: keybd_event(winUser.VK_CONTROL,0,KEYEVENTF_KEYDOWN,0) keybd_event(ord('C'),0,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYDOWN ,0) time.sleep(0.01) keybd_event(ord('C'),0,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0) keybd_event(winUser.VK_CONTROL,0,KEYEVENTF_KEYUP,0) Thread = thread() Thread.start() except: pass script_cKey.__doc__=_("kb:control+c") def terminate(self): return ui.message(_("terminating")) __gestures = { "kb:control+c": "cKey", }