r/applescript • u/techsparrowlionpie • Nov 02 '23
How can you programmatically close a specific app window with macos.
For example I have a couple safari windows or chrome windows opened. How can I close a specific one window instance of the app?
5
Upvotes
2
u/libcrypto Nov 02 '23
What are you using to identify the window you want to close?
2
u/stephancasas Nov 03 '23
You can do it using bundle id, pid, process name, etc. The correct answer is whatever delivers a consistent outcome.
1
u/feigeiway Nov 03 '23
Depending on the app, each app can have multiple documents. So you would close document x of app x