将窗口移动到左上角

时间:2012-10-18 08:02:41

标签: macos window applescript

我正在尝试将窗口移动到屏幕的左上角。

这就是我写的:

tell application "System Events"
    tell application process "appIT"
        tell window 1
            --Move lobby to left corner
            set s to size
            activate
            set the bounds to {40, 40, item 1 of s, item 2 of s}
        end tell
    end tell
end tell

但是当我运行脚本时,我收到了这个错误:

  

系统事件发现错误:我无法将应用程序进程“appIT”的窗口1的边界设置为{40,40,1037,696}

我做错了什么?

2 个答案:

答案 0 :(得分:0)

我能够用这样的东西得到它:

tell application "appIT"
    tell window 1
        --Move lobby to left corner
        set s to bounds
        activate
        set the bounds to {40, 40, (item 3 of s) - (item 1 of s), (item 4 of s) - (item 2 of s)}
    end tell
end tell

答案 1 :(得分:0)

我得到了它的工作:

tell window 1
    activate
    set position to {0, 20}
end tell