Guest User

COM_HelloWorld.py

a guest
Dec 17th, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. #COM_HelloWorld.py
  2. class HelloWorld:
  3.     _reg_clsid_ = "{BC0212DE-F1AF-4626-9E35-424CC4723C02}"
  4.     _reg_desc_ = "Python Test COM Server - Hello World"
  5.     _reg_progid_ = "zzPython.HelloWorldServer"
  6.     _public_methods_ = ['Hello']
  7.     _public_attrs_ = ['softspace', 'noCalls']
  8.     _readonly_attrs_ = ['noCalls']
  9.  
  10.     def __init__(self):
  11.         self.softspace = 1
  12.         self.noCalls = 0
  13.  
  14.     def Hello(self, who):
  15.         self.noCalls = self.noCalls + 1
  16.         # insert "softspace" number of spaces
  17.         return "Hello" + " " * self.softspace + who
  18.  
  19. if __name__=='__main__':
  20.     import win32com.server.register
  21.     win32com.server.register.UseCommandLine(HelloWorld, debug=1)
Advertisement
Add Comment
Please, Sign In to add comment