Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
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
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!
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.
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
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 ;-)
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.
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
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.
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.