Tired of LogMessage?
March 4th, 2005 by Patrick Boucher - Viewed 1898 times - Popularity: 3%OK…
1 | Application.LogMessage("Whatever") |
Am I tired of writing this in my XSI Python scripts you think? In Python, variables are basically pointers to the actual object and everything in Python is an object, functions included… Hmmm…
Try using this at the top of your python scripts:
1 2 | xsi = Application pr = xsi.__getattr__("LogMessage") |
Now you can do:
1 2 | xsi.Whatever(attrib) pr(whatever.Property) |
instead of
1 2 | Application.Whatever(attrib) Application.LogMessage(whatever.Property) |
All of this with absolute minimal overhead! My wrists will be thanking my little brain fart in twenty years!





March 20th, 2005 at 11:07 pm
[...] #8217;s win32com module and why you have to know it exists in the XSI context as well as a tip concerning Application.LogMessage(””)… Well why not make things a little simpler still. If you unzip thi [...]
April 10th, 2005 at 5:53 am
A little trick to add to this one:
pr = Application.LogMessage is equivalent (but shorter) to Application.__getattr__(”LogMessage”)
Python is great!
July 7th, 2008 at 3:32 am
[...] Python’s win32com module and why you have to know it exists in the XSI context as well as a tip concerning Application.LogMessage(”")… Well why not make things a little simpler [...]