■
ということで早速小ネタ.Personal Dictionary for Win32という辞書検索作成ソフトを使って辞書検索.
以下のプログラムをconfig.pyにコピーしてPdicFind()を適当なキーに割り当てる.要win32all.
import win32ui import dde dicgroup="/dic" #検索に使いたい辞書モード.頭に/をつける.詳しくはPdicのヘルプ参照 def PdicFind(): u"""辞書検索(Pdic)""" word=GetValue() server = dde.CreateServer() server.Create('findword') conv = dde.CreateConversation(server) try : conv.ConnectTo('PDICW','Dictionary') conv.Poke('Open',dicgroup) except: import _winreg try: hkey=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\ReliefOffice\CurrentVersion\App Paths\PDICW32.EXE") path=_winreg.EnumValue(hkey,0)[1] _winreg.CloseKey(hkey) except: SetValue(u"Pdicのパスが見つかりません.") return ShellExecute( None, path, '', '', SW_MINIMIZE ) SetValue(u"Pdicを起動しています.もう一度検索してください.") return try : conv.Poke('ForwardSearch', word) result=conv.Request('ForwardSearch') except: result=u"見つかりませんでした。" conv.Poke("Close", "") PopList(result.split('\n'))