我想将特定应用的窗口移动到确定的坐标。
我制作了一个原始剧本,但我想以更优雅和更实用的方式制作它。它应该只移动标题中包含确定单词的窗口。也许我们应该在标题中创建一个带有该单词的窗口列表,然后循环遍历它们以放置在那些坐标处。
我怎样才能做到这一点?
这就是我到目前为止所写的内容:
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
答案 0 :(得分: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