代码之家  ›  专栏  ›  技术社区  ›  Alana Storm

使用AppleCcript记录窗口边界(维度)

  •  0
  • Alana Storm  · 技术社区  · 15 年前

    我已经很久没有处理过applescript了,所以很抱歉把这里的术语搞砸了。

    使用下面的代码片段,我可以调整窗口的大小

    tell application "BBEdit"
        activate
        set the bounds of the first window to {100, 0, 700, 700}
    end tell
    

    我有兴趣使用类似的语句来读取并记录第一个窗口的边界。我试过

    tell application "BBEdit"
        activate
        log (the bounds of the first window)
        set wSize to the bounds of the first window
        log wSize
    end tell
    

    但是列出的事件日志

    (*bounds of window 1*)
    

    每一次。我在等更像

    {100, 0, 700, 700}
    

    我的最终目标是创建一个包含窗口边界的变量,并以编程方式操纵这些值。第一步是学习如何正确记录这些值。

    所以,我如何在苹果的脚本编辑器中记录窗口应用程序的边界。

    3 回复  |  直到 15 年前
        1
  •  1
  •   Philip Regan    15 年前

    get

    tell application "BBEdit"
        log (get bounds of window 1)
    end tell
    --> Log: (*332, 44, 972, 896*)
    
        2
  •  1
  •   Peter Hosey    15 年前

        3
  •  1
  •   regulus6633    15 年前