Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Centre Window on Screen] Centres the frontmost window on screen #AppleScript #SystemEvents #UI #window #position
use application "System Events"
property process : a reference to (first process whose frontmost = true)
property window : a reference to front window of my process
property display : a reference to scroll area 1 of process "Finder"
if not (my window exists) then return
set [width, height] to size of my window
set [screenX, screenY] to size of my display
set position of my window to [(screenX - width) / 2, (screenY - height) / 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.