Applescript click on window title bar

197 views Asked by At

I am trying to write an applescript for macOS Monterey that moves a window to a different workspace via a keyboard shortcut. To move a window I would need to simulate clicking on that window's title bar and then activate the Mission Control shortcut to switch spaces.

I cannot, however, figure out how to simulate the title bar click. Anyone has any ideas?

tell application "System Events"
    -- click on the frontmost window's title bar and hold
    key down {option}
    key code window_number_code
    key up {option}
    -- release hold
end tell
0

There are 0 answers