如何解决并行运行AppleScript处理程序
我想并行运行两次此AppleScript处理程序(所以我希望tillSideBySideWindows("right")
的两个调用异步运行,而不是互相运行),有没有办法实现?
on tillSideBySideWindows(direction)
tell application "System Events"
set allVisibleProcessNames to name of processes whose visible is true
repeat with processName in allVisibleProcessNames
set windowsOfCurrentApp to every window of application process processName
repeat with currentWindow in windowsOfCurrentApp
set currentWindowsSize to size of currentWindow
set currentWindowsWidth to item 1 of currentWindowsSize
set currentWindowsPosition to position of currentWindow
set currentWindowsLeftPos to item 1 of currentWindowsPosition
if currentWindowsLeftPos = 0 then
if direction = "right" then
set currentWindowsWidth to currentWindowsWidth + 30
else
set currentWindowsWidth to currentWindowsWidth - 30
end if
set currentWindowsHeight to item 2 of currentWindowsSize
set winName to name of currentWindow
set size of window winName of application process processName to {currentWindowsWidth,currentWindowsHeight}
end if
if (currentWindowsLeftPos + currentWindowsWidth) = 1680 then
set currentWindowsHeight to item 2 of currentWindowsSize
if direction = "right" then
set currentWindowsLeftPos to currentWindowsLeftPos + 30
set currentWindowsWidth to currentWindowsWidth - 30
else
set currentWindowsLeftPos to currentWindowsLeftPos - 30
set currentWindowsWidth to currentWindowsWidth + 30
end if
set winName to name of currentWindow
set position of window winName of application process processName to {currentWindowsLeftPos,0}
set size of window winName of application process processName to {currentWindowsWidth,currentWindowsHeight}
get currentWindowsWidth
end if
end repeat
end repeat
end tell
end tillSideBySideWindows
tillSideBySideWindows("right")
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。