Fri, Nov 8, 8:30 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 Sep 18 2:50 am)

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: Starting the Mac OS finder with python


Bastep ( ) posted Fri, 13 October 2023 at 4:37 PM · edited Fri, 08 November 2024 at 4:51 PM

I am currently writing a tool to change the textures of figures and props at once. I start the Windows Explorer at a certain place. Depending on the operating system, the Mac OS Finder should also be able to start at this point. But I don't know anything about the Mac OS, nor do I have access to a Mac computer.
Can someone help me?
With kind regards

The code for the Windows Explorer in shortened form

import subprocess
import platform


command = 'explorer /select,"{}"'.format(self.__File)
    if platform.system() == 'Windows':
        subprocess.Popen(command)



an0malaus ( ) posted Sat, 25 November 2023 at 7:45 PM

Uh. I encountered this a couple of years ago and found a solution for macOS. I will search and post shortly (I hope).



My ShareCG Stuff

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


an0malaus ( ) posted Sat, 25 November 2023 at 8:01 PM

OK. Found it. I remembered working with Andy (structure) on this prior to his tragic passing.

if sys.platform == "win32":
os.startfile( helpFile )
else:
subprocess.call( [ "open", helpFile ] )

The OS test you have is fine, so that can stay.
The next question becomes "Do you care about blocking?"
I.e. the "open" call will basically just tell macOS Finder to open the file with whatever it normally would.

If you need Poser Python to wait for that app (whichever one opens the file) to quit, then a "-W" parameter after the "open" should work.

It all gets quite a bit harder if you need to test for the file being closed, rather than the app quitting.

Hope this helps. :-D



My ShareCG Stuff

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


Bastep ( ) posted Mon, 27 November 2023 at 6:59 AM
an0malaus posted at 8:01 PM Sat, 25 November 2023 - #4478166

OK. Found it. I remembered working with Andy (structure) on this prior to his tragic passing.

if sys.platform == "win32":
os.startfile( helpFile )
else:
subprocess.call( [ "open", helpFile ] )

The OS test you have is fine, so that can stay.
The next question becomes "Do you care about blocking?"
I.e. the "open" call will basically just tell macOS Finder to open the file with whatever it normally would.

If you need Poser Python to wait for that app (whichever one opens the file) to quit, then a "-W" parameter after the "open" should work.

It all gets quite a bit harder if you need to test for the file being closed, rather than the app quitting.

Hope this helps. :-D

Thanks for the effort. I will integrate this into my Python code and then hope that it works as I imagine.

Greetings and have a nice Monday



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.