Skip to content

Instantly share code, notes, and snippets.

@xiaolai
Last active August 27, 2021 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiaolai/93d280e546b8e84b3da78c1b1b688200 to your computer and use it in GitHub Desktop.
Save xiaolai/93d280e546b8e84b3da78c1b1b688200 to your computer and use it in GitHub Desktop.
Align 9 Quicktime Windows to 3x3 grid
on getDesktopSize()
tell application "Finder"
set screen_resolution to bounds of window of desktop
end tell
return {item -2 of screen_resolution, item -1 of screen_resolution}
end getDesktopSize
on putToPosition(n)
set window_width to round ((item 1 of getDesktopSize()) / 3) - 1
set window_height to round ((item 2 of getDesktopSize()) / 3) - 1
set row to (round of ((n - 1) / 3) rounding down) + 1
set topLeftX to window_width * ((n - 1) mod 3)
set topLeftY to (row - 1) * window_height
set bottomLeftX to window_width * (((n - 1) mod 3) + 1)
set bottomLeftY to (row) * window_height
set position to {topLeftX, topLeftY, bottomLeftX, bottomLeftY}
tell application "QuickTime Player"
try
set bounds of window n to position
set the looping of the document of window n to true
set the current time of the document of window n to 120
play the document of window n
end try
end tell
return position
end putToPosition
on run {input, parameters}
repeat with i from 1 to 9
putToPosition(i)
end repeat
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment