How to programatically get an OSX window id from a process id on 10.6? (using Applescript, Objective-C, whatever)
问题 I know that I can do tell application "Safari" to id of window 1 to get the window ID of Safari. However, this only works for Applescriptable applications. I want to be able to write a program that will take a PID as input and output the window ID. (In case you are curious, this will be used in turn to supply the window ID to the undocumented "CGSMoveWorkspaceWindowList" to move applications between spaces on 10.6.) According to this question, it is possible to do it via undocumented APIs in