Sat, Feb 1, 4:45 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Python hook for Text Editor in General Preferences query


an0malaus ( ) posted Sun, 19 December 2004 at 3:48 AM · edited Wed, 20 November 2024 at 3:40 AM

I'm trying to create a simplistic workaround for a part of the Poser CFM/Python Tkinter MachO brokeness. I need to be able to edit some parameters stored in a text file. I can already do this if I bind the text file to a Python script button and Ctrl-click the button, but I'd like to find a way to determine the path to the Text Editor defined in the Poser 5 General Preferences. I haven't found a hook for this in the Python Manual on Mac OS X (If it's there, I must be truly blind ;-) ). I've looked at the script which launches the text editor, but it appears poser is probably passing in the file to edit in the command line parameters (argv) or something, as I can't see a separate parameter for which file to open. Can anyone help? (Ockham, stewer)?



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


ockham ( ) posted Sun, 19 December 2004 at 11:10 AM

On PC: The path itself is the same in both 4 and 5: it's a line in Poser.ini under runtime/prefs. I don't know if Mac would have the same. PYTHON_EDITOR_PATH "C:KEDITWkeditw32.exe" To catch the line: EdPath='' FileName=os.path.normpath('runtime/prefs/poser.ini') fp=open(FileName,'rt') while 1: ~st=fp.readline() ~if not st: break ~Parts=string.split(st) ~if (len(Parts)>1): ~~if string.count(Parts[0],'PYTHON_EDITOR_PATH'): ~~~EdPath=Parts[1] ~~~break fp.close()

My python page
My ShareCG freebies


an0malaus ( ) posted Sun, 19 December 2004 at 11:27 AM

Great! Thanks for the hint ockham. P5 on Mac uses ":Runtime:prefs:Poser Prefs" rather than poser.ini, but it looks like it has the same contents. Mine has PYTHON_EDITOR_PATH "Sirius:Applications:BBEdit Lite 6.1:BBEdit Lite 6.1" Your code fragment is exactly what I need to extract this file path. Cheers!



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


ockham ( ) posted Sun, 19 December 2004 at 11:36 AM

Incidentally, I've also used the trick of ctrl-click to edit non-Python files like CR2's. It's a nice little hidden feature of Poser!

My python page
My ShareCG freebies


an0malaus ( ) posted Sun, 19 December 2004 at 12:05 PM

Ockham, thought you should know that given Mac file names often (and in my case do) contain spaces, I've had to amend the line ~~~EdPath=Parts[1] to read ~~~EdPath=" ".join(Parts[1:]) which puts the remainder of the list of space-separated substrings back into a single file path. Other than that, it works, provided I remember to put a colon in front of Runtime:prefs:Poser Prefs in the normpath line ;-)



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


ockham ( ) posted Sun, 19 December 2004 at 12:13 PM

Spaces can be messy. I wish Python had scanf-type formatting for reading strings. It's easier to handle than split and join. Printf-type formatting is already present for forming strings, so why didn't they use it for reading as well? Mysteries of the universe.

My python page
My ShareCG freebies


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.