Bastep opened this issue on Oct 13, 2023 ยท 4 posts
Bastep posted Fri, 13 October 2023 at 4:37 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).
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
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
Thanks for the effort. I will integrate this into my Python code and then hope that it works as I imagine.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