Forum: Poser Python Scripting


Subject: More Q's on controlling external apps from Poser Python

layingback opened this issue on Dec 03, 2003 ยท 6 posts


ockham posted Fri, 05 December 2003 at 10:01 AM

Execfile is indeed clumsy. It seems to open a "DOS box", which gets all tangled up with Poser. You might try the Spawn family instead, which is only available in Python 2.2 (Poser 5). I don't know if that would be any better. Or use some of the extenders like SWIG or Pyrex to form an external module that can be called from Python. I'm learning how to use SWIG, and it's powerful but tricky. For a simple action with minimal passed values, it works nicely. As for closing down, I don't think Poser gives us a trigger event. (Seems like there was a discussion of this point some time ago; you might search back through the forum.) One possibility: Take advantage of the "exitfunc" action in Python itself. Since Poser closes down all the scripts that it owns, the exitfunc could call a out-of-Python program when your startup script detected that it was being closed down. This would require the script to keep running during the session, though. Another way: The startup script could trigger a plain little Windows app that keeps running in the background, watching the files that Poser rewrites when it's done. Specifically, when poser.ini changes its last-written time, Poser has just finished.

My python page
My ShareCG freebies