PURPOSE
This macro/subroutine, when executed from another macro using the Execute a Macro action, sets the Macintosh Sound Input to a specified name. This can include Apple HomePods and other AirPlay devices. Note that this shortcut uses AppleScript that automates the User Interface, specifically the System Preferences (Monterey or earlier) or System Settings (Ventura+). See Automating the User Interface (Mac Automation Scripting Guide: Automating the User Interface) for more information.
If this subroutine is called using Execute a Subroutine action, additional features are provided that can be useful if the macro is combined with Set Sound Output. See PARAMETERS below.
SUBROUTINE PARAMETERS
Sound Input Name :
Note that any spaces and punctuation marks must exactly match the entries in the System Preferences (or System Settings) > Sound > Output. For example, Jim’s AirPods Pro includes a smart apostrophe ( ’ ).
Save Initial State :
0 (No); 1 (Yes)
This saves, in a persistent Dictionary, the Open|Closed state and, if Open, the Displayed Pane. This value can then be retrieved by another instance of Set Sound Input (SSI) or the sister macro Set Sound Output (SSO).
Exit Action :
0 (Initial State, i.e., the state when SSI started; i.e., Open|Closed, if Open, which Displayed Pane)
1 (Saved State, i.e., the state saved in the Dictionary by SSI or SSO)
2 (Open–to the Sound pane)
3 (Close)
This value specifies the action to be taken with the System Preferences (or System Settings) after the Sound Input is set.
CREATING A CALLING MACRO
If the macro is executed directly (e.g., from the Keyboard Maestro Editor), a dialog will appear that presents an option to create a calling macro. The dialog will prompt for the Sound Input Name. Note that any spaces and punctuation marks must exactly match the entries in the System Preferences (or System Settings) > Sound > Input. For example, Jim’s AirPods Pro includes a smart apostrophe ( ’ ).
If the Call As a Subroutine dialog checkbox is selected, the created macro will have the flexibility to use the SUBROUTINE PARAMETERS described above.
LOCALIZATION
By default, the AppleScript User Interface Scripting is set for English. If another Language is set under System Preferences (or System Settings) Language & Region, the variable local_Pane needs to be set to Sound|Geluid|Ton (English, Nederlands, or Deutsch). Other languages could be easily added.
LIMITATIONS
This macro requires Keyboard Maestro v10.0+.
TESTED WITH
• Keyboard Maestro 10.2
• Ventura 13.3.1 (22E772610a)/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445
VERSION HISTORY
1.0 - Initial version; compatible with Set Sound Output, v6.0 or later. For more information see: Using 'Set Sound Output' and 'Set Sound Input' Together
Download: Set Sound Input.kmmacros (158 KB)
Macro-Image
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 10.14.6 (18G9323)
- Keyboard Maestro v10.2