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.
Replies
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 an error, while or ('spam', 'eggs') would work. This is why my example code has double brackets.
As for showing the desktop, there's apparently some Windows scripting that you can do, but I haven't figured it out yet.
Cheers!
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 windows callback function, you COULD use the lParam value to pass an object that contains the string for a more elegant approach, but yeah, a bit more complicated
win32gui.GetForegroundWindow() has a few tricks based around it.
HOWEVER. For the life of me i cannot get the win32 module to install now...
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
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.