【问题标题】:Applescript: pulling apart a bounds recordApplescript:拉开边界记录
【发布时间】:2016-04-29 04:58:07
【问题描述】:

我最近未对 El Capitan 进行分级,Finder 对新窗口的大小和位置的想法让我抓狂。

所以,我想写一个applescript,它会保留窗口的左坐标,将顶部设置为尽可能高,并将宽度和高度设置为特定值。

我可以得到界限:

tell application "Finder"
  set theBounds to bounds of front window
end tell

但如果我要求 left of theBounds 我会收到错误消息。

Applescript 确实提供了一种解压bounds 的方法?

【问题讨论】:

    标签: applescript bounds


    【解决方案1】:

    bounds 属性返回类型rectangle。这只是代表左上点的 x/y 坐标和右下点的 x/y 坐标的四个整数值的列表。也许这个小脚本更清楚:

    tell application "Finder"
        set {x1, y1, x2, y2} to bounds of front window
        set {winWidth, winHeight} to {x2 - x1, y2 - y1}
    end tell
    

    您可以用同样的方法设置坐标。定义左上角的 x 和 y 并将目标宽度添加到 x1 并将目标高度添加到 y1 以获得第三和第四个值。

    祝你有美好的一天,迈克尔/汉堡

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-23
      • 2014-07-13
      • 1970-01-01
      • 2010-09-18
      • 2019-11-11
      • 2012-12-26
      • 1970-01-01
      • 2019-05-19
      相关资源
      最近更新 更多