Currently working with Pymel inside of Maya. I'm struggling to find a way to "alt-tab"/switch onto another open application after running a script. Say if i clicked an "export to desktop" button, the script would then tab me onto my desktop. Any input would be really useful, as Im very much flying blind at the moment.
Quick note that I forgot to mention. The script will stop will stop and wait for the program to close. So, in the case of Photoshop, you would have to quit out of Photoshop in order to resume with the Python script in Maya (and possibly interacting in Maya too). Subprocess will also give you the exit code of the program (0…
Looks like the module that you're looking for is something called subprocess. http://docs.python.org/2.7/library/subprocess.html Quick example: Let's say that you want to open up a texture in photoshop. Quick note: Subprocess requires you to have the arguments in a tuple or list. So, something like "spam eggs" would cause…
don't know if this works out of the box, just typed it down using some of my codes as a reference, maybe i missed something. I can't test it now, i'm on a mac :D you can of course extend that to open the program like you already did, if the window is not found etc. i'm using global variables to get the string to the…
never used it, and depending on non-standard packages is always bad if you have to install them becaue they come in some kind of compiled form... use ctypes, it is a standard-module and you can do everything with it that you can do with Win32 module, maybe with a little bit more work on your side ;)
Comtypes is a good alternative I find to the win32 one which can be buggy, I have had great success controling Photoshop with maya's python interpreter this way. Actually if you look in my SIG at the psLink video that was all done with the openmaya api and comtypes with maya's built in python.
Found some neat stuff you can do with Win32 module. win32gui.GetForegroundWindow() has a few tricks based around it. HOWEVER. For the life of me i cannot get the win32 module to install now...
Awesome. This worked really well for initiating the program if its not already open. One issue is that I'm using unity as the targeted application and if Unity is already open and you try to open another instance it throws an error dialog. Is there a way to check if the Unity process is already running, and if so, bring it…