如何使用 AppleScript(优雅地)激活 Safari 窗口?
虽然可以使用系统事件模拟 command-shift-` 来更改 Safari 中的窗口,但是否没有更好的方法使用 AppleScript 来做到这一点?我可以更改 Safari 窗口的索引,这会更改它们在屏幕上的顺序,但不会使它们处于活动状态。假设您有两个包含 about:blank 的 Safari 窗口 - 如何将后面的窗口调到前面并使其处于活动状态?
当然,command-shift-` 是有效的,所以也许只需要一种方法来给这只猫剥皮。
While one can simulate command-shift-` using System Events to change windows in Safari, is there no better way to do this with AppleScript? I can change the index of Safari's windows, this changes their ordering on the screen but does not make them active. Suppose you have two Safari windows containing about:blank -- how could you bring the one in the back to the front and make it active?
Granted, command-shift-` works, so maybe there only needs to be one way to skin this cat.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还注意到,更改索引确实会对窗口重新排序,但新窗口实际上并未出现在前面。通过尝试,我发现你可以通过使用“可见”属性来解决这个问题......
I also noticed that changing the index does reorder the windows however the new window does not actually come to the front. By playing around I found you can fix that by playing with the "visible" property...