Use these together with https://redsweater.com/fastscripts/ for global hotkey goodness in macOS
Requirements:
brew install fastscripts
Download all the scripts and put them in ~/Library/Scripts/
Use these together with https://redsweater.com/fastscripts/ for global hotkey goodness in macOS
Requirements:
brew install fastscripts
Download all the scripts and put them in ~/Library/Scripts/
set mySearch to text returned of (display dialog "Search for Chrome tab" default answer "") | |
tell application "Google Chrome" | |
activate | |
set tabIndex to 0 | |
set theWindow to first window whose index is 1 | |
repeat with theTab in tabs of theWindow | |
set tabIndex to tabIndex + 1 | |
if title of theTab contains mySearch then | |
set active tab index of theWindow to tabIndex | |
exit repeat | |
end if | |
end repeat | |
end tell |
set mySearch to text returned of (display dialog "Search for Firefox tab" default answer "") | |
tell application "Firefox Developer Edition" | |
activate | |
tell application "System Events" to keystroke "1" using command down | |
set firstTitle to name of front window | |
set myTitle to "__f_o_o_b_a_r__" | |
set counter to 0 | |
repeat until (myTitle contains mySearch or counter > 100 or myTitle is equal to firstTitle) | |
tell application "System Events" to key code 121 using control down | |
delay 0.05 | |
set myTitle to name of front window | |
set counter to counter + 1 | |
end repeat | |
end tell |
display notification with title "Toggling mute in Google Meet" | |
tell application "Google Chrome Beta" | |
set tabIndex to 0 | |
set theWindow to first window whose index is 1 | |
repeat with theTab in tabs of theWindow | |
set tabIndex to tabIndex + 1 | |
if title of theTab starts with "Meet " then | |
set active tab index of theWindow to tabIndex | |
activate | |
-- The shortcut needs to have been released before keystroke is sent | |
set keyDown to "42" | |
set counter to 0 | |
repeat until (keyDown is "0" or counter > 10) | |
set keyDown to do shell script "/usr/bin/python -c 'import Cocoa; print(Cocoa.NSEvent.modifierFlags())'" | |
set counter to counter + 1 | |
end repeat | |
tell application "System Events" to keystroke "d" using command down | |
end if | |
end repeat | |
end tell |
if input volume of (get volume settings) = 0 then | |
set volume input volume 100 | |
display notification "Volume set to 100" with title "✅ Microphone is on" | |
else | |
set volume input volume 0 without output muted | |
display notification "Volume set to 0" with title "❌ Microphone is muted" | |
end if |
if output muted of (get volume settings) is true then | |
set volume without output muted | |
display notification with title "✅ Volume is on" | |
else | |
set volume with output muted | |
display notification with title "❌ Volume is off" | |
end if |
display notification with title "Locking screen" | |
tell application "Spotify" | |
pause | |
end tell | |
do shell script "/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine" |
tell application "Spotify" | |
next track | |
delay 0.5 | |
set theTrack to name of current track | |
set theArtist to artist of current track | |
display notification theArtist & ": " & theTrack with title "⏭️" | |
end tell |
tell application "Spotify" | |
playpause | |
set theTrack to name of current track | |
set theArtist to artist of current track | |
set current to player position | |
set mins to (round (current / 60) rounding down) | |
set secs to (round (current mod 60) rounding down) | |
if secs is less than 10 then | |
set secs to "0" & secs | |
end if | |
set elapsed to mins & ":" & secs | |
set totalSecs to ((duration of current track) / 1000) | |
set mins to (round (totalSecs / 60) rounding down) | |
set secs to (totalSecs mod 60 div 1) | |
if secs is less than 10 then | |
set secs to "0" & secs | |
end if | |
set total to mins & ":" & secs | |
display notification theArtist & ": " & theTrack with title "⏯ " & elapsed & " / " & total | |
end tell |
tell application "Spotify" | |
set currentTrack to name of current track | |
previous track | |
set nextTrack to name of current track | |
if currentTrack is equal to nextTrack then | |
previous track | |
end if | |
delay 0.5 | |
set theTrack to name of current track | |
set theArtist to artist of current track | |
display notification theArtist & ": " & theTrack with title "⏮" | |
end tell |
tell application "Spotify" | |
set shuffling to not shuffling | |
set theTrack to name of current track | |
set theArtist to artist of current track | |
if shuffling then | |
set isShuffling to "on" | |
else | |
set isShuffling to "off" | |
end if | |
display notification theArtist & ": " & theTrack with title "🔀 " & isShuffling | |
end tell |
tell application "Spotify" | |
set sound volume to sound volume - 9 | |
set theVolume to sound volume as string | |
set theTrack to name of current track | |
set theArtist to artist of current track | |
display notification theArtist & ": " & theTrack with title "🔉 " & theVolume & "%" | |
end tell |
tell application "Spotify" | |
set sound volume to sound volume + 11 | |
set theVolume to sound volume as string | |
set theTrack to name of current track | |
set theArtist to artist of current track | |
display notification theArtist & ": " & theTrack with title "🔊 " & theVolume & "%" | |
end tell |
set vol to output volume of (get volume settings) | |
if vol is 0 then | |
display notification with title "volume is at min" | |
else | |
set volume output volume (vol - 10) | |
set vol to output volume of (get volume settings) | |
display notification with title "volume reduced to " & vol & "%" | |
end if |
set vol to output volume of (get volume settings) | |
if vol is 100 then | |
display notification with title "volume is at max" | |
else | |
set volume output volume (vol + 10) | |
set vol to output volume of (get volume settings) | |
display notification with title "volume increased to " & vol & "%" | |
end if |
What's the difference between
and the one I've seen in other places: