Forum: Poser Python Scripting


Subject: Starting the Mac OS finder with python

Bastep opened this issue on Oct 13, 2023 ยท 4 posts


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