我修改了我不久前找到的一些 AppleScript,以某种方式定位最前面的窗口,以便屏幕/停靠/菜单边缘的每一侧都有大约 10px 的边距:
set front_app to (path to frontmost application as Unicode text)
tell application "Finder"
set _b to bounds of window of desktop
set scrn_width to item 3 of _b
set scrn_height to item 4 of _b
end tell
tell application front_app
activate
set bounds of window 1 to {10, 35, (scrnWidth - 10), (scrnHeight - 80)}
end tell
问题是我必须为每个窗口单独做。我想只运行一次并让它在每个应用程序的所有窗口上运行。
我尝试修改了大约 5 个不同的脚本,但只是得到了错误。这是我所拥有的:
tell application "System Events"
tell application "Finder"
set _b to bounds of window of desktop
set scrn_width to item 3 of _b
set scrn_height to item 4 of _b
end tell
set _windows to get windows of (application processes whose visible is true)
repeat with this_window in (items of _windows)
set bounds of this_window to {10, 35, (scrn_width - 10), (scrn_height - 80)}
end repeat
end tell
任何帮助,将不胜感激!