Here are the ones I made and that seem to work just fine (both controlled by the Toggle Internet macro with one keystroke combination)
Toggle BT.kmmacros (2.4 KB) Toggle Internet.kmmacros (2.4 KB) Toggle WIFI ON:OFF.kmmacros (2.0 KB)
Here are screenshots with code:
ToggleWiFi:
Execute AppleScript
set status to do shell script "networksetup -getairportpower en0"
if status ends with "On" then
do shell script "networksetup -setairportpower en0 off"
else
do shell script "networksetup -setairportpower en0 on"
end if
Toggle BT:
Execute AppleScript
tell application "System Preferences"
reveal pane id "com.apple.preferences.Bluetooth"
-- activate
set the current pane to pane id "com.apple.preferences.Bluetooth"
try
tell application "System Events" to tell process "System Preferences"
click button "Turn Bluetooth Off" of window "Bluetooth"
click button "Turn Bluetooth Off" of sheet 1 of window "Bluetooth" of application process "System Preferences" of application "System Events"
end tell
delay 1
on error
tell application "System Events" to tell process "System Preferences"
click button "Turn Bluetooth On" of window "Bluetooth"
quit
end tell
end try
end tell
ToggleInternet (commands both synchronously; NB: both BT and WiFi must be on or off for this command to turn off or on both)
To add this as a Better Touch Tool button on the Touch Bar (allows you to tap it to trigger the Super-Macro that triggers the two sub-macros), you simply configure a button like this (or as you wish):