I have a simple shell/python script that opens up other windows. I'd like to bring the terminal where the script is running to the foreground when the script has finished.
I know the process ID of my parent window. How can I bring a given window to the foreground? I imagine I have to find out the window name from the PID along the way.
Not sure if there's a proper way, but this works for me:
osascript<<EOF
tell application "System Events"
set processList to every process whose unix id is 350
repeat with proc in processList
set the frontmost of proc to true
end repeat
end tell
EOF
You can do it with osacript -e '...'
too.
Obviously change the 350
to the pid you want.