Applescript 和 Cocoa 窗口位置
我知道使用 Applescript 我可以更改任何应用程序窗口的大小和位置,但是每当窗口更改其大小或位置时是否有可能收到通知?
如果那不可能,那么我的想法是在后台创建一个线程,并不断检查窗口的位置,看看它们是否发生了变化,如果发生了,那么它们就移动了。
但这会占用大量CPU资源来不断比较窗口的位置/大小。那么有可能吗?如果没有,有更好的方法吗?谢谢!
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?
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. So is it possible? If not , is there a better way? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定,但我认为没有相关通知。
我会监听鼠标事件。拖动鼠标时,您可以检查窗口是否有变化。希望有所帮助。
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.