Auto-Close Apps When All Windows Have Been Closed

I implemented a preset which closes specific apps when they've been inactive for a while.

autoclose-apps.bttpreset (8.0 KB)

This is a JavaScript script triggered by deactivation of an app.

Right now, the configuration is straight in the source –30 minutes of inactivity for the following apps:

  let delaySeconds = 60 * 30;

  const allowedBundleIds = [
    "com.microsoft.Excel",
    "org.mozilla.firefox",
    "com.apple.iWork.Keynote",
    "com.apple.iWork.Numbers",
    "com.apple.iWork.Pages",
    "com.microsoft.Powerpoint",
    "com.apple.Preview",
    "com.apple.Terminal",
    "com.microsoft.Word"
  ];

the new pages/Keynote and Numbers seem to have other bundle ids. Works perfect with Microsoft but those are not working. Any idea?

I think ist com.apple.pages now

How would you add Zoom?

Hi @tosbsas,

You can run this command in your terminal to obtain the bundle ID for any app on your Mac:

osascript -e 'id of app "Pages"'

The output is this:

com.apple.Pages

For Zoom, the app name is zoom.us, so you get this:

╭─   ~ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  19:00:03
╰─❯ osascript -e 'id of app "zoom.us"'
us.zoom.xos

I hope this helps.

found it and put it in the script, but its not doing its job with those apps. Only Office 365 apps so far

"com.microsoft.Excel",

"org.mozilla.firefox",

"com.apple.Keynote",

"com.apple.Numbers",

"com.apple.Pages",

"us.zoom.xos",

"com.microsoft.Powerpoint",

"com.apple.Preview",

"com.apple.Terminal",

"com.microsoft.Word"

This it what it looks like in BTT

anyone got an idea? Looks like the Standard Apple Apps are not being touched by the script. Whole Office Suite, Terminal or Preview are not closing, Office 365, Evernote and Zoom do @hugoh

anyone @hugoh