Replies: 1 comment
-
okay, I wrote this script which helps with the clicking. now I just need to hide items that are currently not active #!/bin/bash
# This script takes two parameters:
# $1: application name (e.g., "Control Center")
# $2: the description to match for the menu bar item
#
# Example usage:
# ./click.sh "Control Center" "Clock"
#
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <application> <description>"
exit 1
fi
APP="$1"
DESC="$2"
osascript <<EOF
tell application "System Events"
tell process "$APP"
set found to false
repeat with mi in menu bar items of menu bar 1
try
if (description of mi) starts with "$DESC" then
perform action "AXPress" of mi
set found to true
exit repeat
end if
end try
end repeat
if not found then
# display dialog "Menu item with description '$DESC' not found in $APP." buttons {"OK"} default button 1
end if
end tell
end tell
EOF
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I often enable/disable mic filters for meetings. I also like to switch my focus mode from dnd to sleep. And lastly I sometimes switch FaceTime calls from my phone to my Mac.
All three require click interactions on menu items that are conditional. AudioVideoModule only shows when mic/screen sharing is active. FocusModes shows up when focus is enabled plus about 5s after, and FaceTime only shows during a call or when handover is available.
I'd love to be able to
The first item is more crucial. Scripts like
tell application \"System Events\" to tell process \"Control Center\" to perform action \"AXPress\" of menu bar item 5 of menu bar 1
don't work because the position changes and isn't always5
Beta Was this translation helpful? Give feedback.
All reactions