0

我想将特定应用程序的窗口移动到确定的坐标。

我制作了一个小原始脚本,但我希望以更优雅和更实用的方式拥有它。它应该只移动标题中包含确定单词的窗口。也许我们应该在标题中创建一个带有那个词的窗口列表,然后循环浏览它们以放置这些坐标。

我怎样才能做到这一点?

这就是我到目前为止所写的:

tell application "System Events"
    tell process "AppIT"
        (*
    {804, 368}
{536, 368}
{268, 368}
{0, 368}
{804, 22}
{536, 22}
{268, 22}
{0, 22}
*)
        set position of window 1 to {0, 22}
        set position of window 2 to {268, 22}
        set position of window 3 to {536, 22}
        set position of window 4 to {804, 22}
        set position of window 5 to {0, 368}
        set position of window 6 to {268, 368}
        set position of window 7 to {536, 368}
        set position of window 8 to {804, 368}

        set position of window 9 to {0, 22}
        set position of window 10 to {268, 22}
        set position of window 11 to {536, 22}
        set position of window 12 to {804, 22}
        set position of window 13 to {0, 368}
        set position of window 14 to {268, 368}
        set position of window 15 to {536, 368}
        set position of window 16 to {804, 368}

        set position of window 17 to {0, 22}
        set position of window 18 to {268, 22}
        set position of window 19 to {536, 22}
        set position of window 20 to {804, 22}
        set position of window 21 to {0, 368}
        set position of window 22 to {268, 368}
        set position of window 23 to {536, 368}
        set position of window 24 to {804, 368}
    end tell
end tell
4

1 回答 1

1
tell application "System Events"
    tell process "TextEdit"
        set w to windows where title contains "text"
        set position of item 1 of w to {0, 22}
        set position of item 2 of w to {268, 22}
    end tell
end tell
于 2012-12-15T09:16:10.013 回答