Select A Menu Bar Item Using Bartender

This macro uses Bartender 4's AppleScript dictionary to activate a particular application's menu bar icon, and then press the appropriate sequence of cursor keys to select a given menu item.

It uses several subroutines, which I've also included below.

Download the main "Select menu bar item using Bartender" macro (12 KB)

Show the main macro

Subroutines

Check Bartender is installed and running

This macro checks that Bartender is installed (using the "Check that an application is installed" subroutine described below) and that it is running. If it is installed but not running, it is activated.

Download the "Check Bartender is installed and running" macro" (6.9 KB)

Show the macro

Check that an application is installed

Checks that an application is installed at the given path (/Applications by default).

Download the "Check that an application is installed" macro (6.4 KB)

Show the macro

Join file paths

A helper subroutine to join two file paths.

Download the "Join file paths" macro (2.2 KB)

Show the macro

Suffix filename with extension

A helper subroutine to append a filename with an extension, if it does not already have one.

Download the "Suffix filename with extension" macro (3.6 KB)

Show the macro

Join strings

A tiny helper subroutine to join two strings with a separator.

Download the "Join strings" macro (3.5 KB)

Show the macro

Press sequence of keys

See the Press Sequence of Keys subroutine.

1 Like