I know the process id of an application in Mac OS X. How can I switch to it (using applescript, or python, or whatever)?
By "switch", I mean, put in focus.
The usual solution is to use the applescript code tell application "Foo" activate, but here the name is not useful because I have many instances of the same application running. I am however able to get the process id of the application.
How can I switch to this application programmatically?