def Register(): import sys if '-d' in sys.argv: dispatcher = "DispatcherWin32trace" debug_desc = " ("+dispatcher+")" debug_option = "Yes" else: dispatcher = None debug_desc = "" debug_option = "" categories = [axscript.CATID_ActiveScript,axscript.CATID_ActiveScriptParse] clsid = PyDump_CLSID lcid = 0x0409 # // english policy = None # "win32com.axscript.client.axspolicy.AXScriptPolicy" print "Registering COM server%s..." % debug_desc from win32com.server.register import RegisterServer languageName = "PyDump" verProgId = "Python.Dumper.1" RegisterServer(clsid = clsid, pythonInstString = "win32com.axscript.client.pyscript.PyDumper", className = "Python Debugging/Dumping ActiveX Scripting Engine", progID = languageName, verProgID = verProgId, catids = categories, policy=policy, dispatcher = dispatcher) CreateRegKey(languageName + "\\OLEScript") # Basic Registration for wsh. win32com.server.register._set_string(".pysDump", "pysDumpFile") win32com.server.register._set_string("pysDumpFile\\ScriptEngine", languageName) print "Dumping Server registered."
def adddir(self, dir): if type(dir) == type(''): sys.path.append(dir) return str(sys.path) def echo(self, arg): return repr(arg) def sleep(self, t): time.sleep(t) if __name__=='__main__': from win32com.server.register import RegisterServer, UnregisterServer clsid = "{06ce7630-1d81-11d0-ae37-c2fa70000000}" progid = "Python.Tools" verprogid = "Python.Tools.1" if "--unregister" in sys.argv: print "Unregistering..." UnregisterServer(clsid, progid, verprogid) print "Unregistered OK" else: print "Registering COM server..." RegisterServer(clsid, "win32com.servers.PythonTools.Tools", "Python Tools", progid, verprogid) print "Class registered."