Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Script for closing an application's window in Mac OS Big Sur

Hey!


Recently I used this script for closing windows on my Mac:

tell application "System Events"
tell process "Application"
click button 1 of window 1
end tell
end tell

But now it doesn't work. Can anybody suggest any way to close windows through the scripts?

MacBook Pro 15″, macOS 11.0

Posted on Nov 16, 2020 5:36 AM

Reply
Question marked as Best reply

Posted on Nov 16, 2020 5:45 AM

There are two forms of this: 1) closing an application's front most window, or quitting the application:


use scripting additions

tell application "Application" to if it is running then close its front window


or


use scripting additions

tell application "Application" to if it is running then quit


10 replies

Script for closing an application's window in Mac OS Big Sur

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.