EuxhenH
EuxhenH

Reputation: 161

Applescript click on window title bar

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

Upvotes: 0

Views: 242

Answers (0)

Related Questions