How does one set a value via win32com

Richard Weth richard at loudcloud.com
Tue Mar 27 15:24:12 EST 2001


All

I have been banging away on an assignment that requires me to alter com
plus settings
(something one should never do normally). Here is the pertinent code
fragment:
import win32com.client
import regex
wcc = win32com.client

adm = wcc.Dispatch( "COMAdmin.COMAdminCatalog" )
app = adm.GetCollection("Applications")
app.Populate()

for thingy in app:
  if regex.match("^Hello World.*",thingy.Name)!= -1:
    print "what we have here is ...",thingy.Name
    thingy.Value("Name") = thingy.Name + "t0"          #
<================ THE PROBLEM
    break

  else:
    print thingy.Name
app.SaveChanges()


Now the code in VBS
    thingy.Value("Name") = thingy.Name & "t0"
works just fine but in python I get:
>>> thingy.Value("Name") = "joemama"
SyntaxError: can't assign to function call

Is there a way to set that (and other) properties in Python via
win32com. I really
would like to learn as little VB as humanly possible and not write this
in it's own VBScript.
Any and all suggestions welcome!

--
Sincerely
  Richard A. Weth
  Sr. Software Engineer
  LoudCloud, Inc
  richard at loudcloud.com






More information about the Python-list mailing list