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)
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)
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)
Join file paths
A helper subroutine to join two file paths.
Download the "Join file paths" macro (2.2 KB)
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)
A tiny helper subroutine to join two strings with a separator.
Download the "Join strings" macro (3.5 KB)
Press sequence of keys
See the Press Sequence of Keys subroutine.