[英]Applescript and Cocoa window positions
I know that using Applescript I can change the size and position of any application's window, but is it possible to get a notification whenever a window has changed it size or position? 我知道使用Applescript可以更改任何应用程序窗口的大小和位置,但是每当窗口更改大小或位置时,是否都能收到通知?
If thats not possible, then what I was thinking was making a thread in the background, and constantly check the positions of windows and see if they have changed, if they did then they moved. 如果那不可能,那么我在想的是在后台创建一个线程,并不断检查窗口的位置,查看它们是否已更改,如果已更改,则将其移动。
But that would take a lot of cpu resources to constantly compare the positions/sizes of window. 但这将需要大量的cpu资源来不断比较窗口的位置/大小。 So is it possible?
那有可能吗? If not , is there a better way?
如果不是,是否有更好的方法? Thanks!
谢谢!
I'm not sure but i think there isn't a notification for that. 我不确定,但我认为没有通知。 I would listen for mouse events.
我会听鼠标事件。 When the mouse was dragged you can check the windoews for changes.
拖动鼠标后,您可以检查窗框是否有变化。 Hope that helpa.
希望有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.