Skip to content

Commit

Permalink
Tweaking Sonos Applescripts
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismessina committed Sep 23, 2020
1 parent f20d3a7 commit 4c59017
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
Binary file modified workflows/sonos-toolkit/sonos-toolkit.alfredworkflow
Binary file not shown.
58 changes: 38 additions & 20 deletions workflows/sonos-toolkit/src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
<string>---- Raise Volume--
on alfred_script(q)
tell application "System Events" to tell process "Sonos" set value of slider 1 of window 1 to get (value of slider 1 of window 1) + 5
end tell
end alfred_script</string>
Expand Down Expand Up @@ -314,7 +316,9 @@ end alfred_script</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
<string>---- Search--
on alfred_script(q)
activate application "Sonos"
tell application "System Events" to tell process "Sonos"
set frontmost to true delay 1 set the value of text field 1 of window 1 to q
Expand Down Expand Up @@ -385,7 +389,9 @@ end alfred_script</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q) tell application "System Events" to tell process "Sonos" set value of slider 1 of window 1 to get (value of slider 1 of window 1) - 5 end tellend alfred_script</string>
<string>---- Lower Volume--
on alfred_script(q) tell application "System Events" to tell process "Sonos" set value of slider 1 of window 1 to get (value of slider 1 of window 1) - 5 end tellend alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
Expand Down Expand Up @@ -442,7 +448,9 @@ end alfred_script</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)try tell application "System Events" tell process "Sonos" set frontmost to true click menu item "Mini Controller" of menu 1 of menu bar item "Window" of menu bar 1 (* if exists (window 2 of process "Sonos") then*) click button 10 of window 2 (* Close Main Window *) end tell (* end if*) end tell return trueon error return falseend tryend alfred_script</string>
<string>---- Switch to Mini Player--
on alfred_script(q)try tell application "System Events" tell process "Sonos" set frontmost to true click menu item "Mini Controller" of menu 1 of menu bar item "Window" of menu bar 1 (* if exists (window 2 of process "Sonos") then*) click button 10 of window 2 (* Close Main Window *) end tell (* end if*) end tell return trueon error return falseend tryend alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
Expand Down Expand Up @@ -488,7 +496,9 @@ end alfred_script</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
<string>---- Toggle Mute--
on alfred_script(q)
tell application "System Events" tell process "Sonos" click button 1 of window 1
end tell end tell
end alfred_script</string>
Expand All @@ -508,18 +518,18 @@ end alfred_script</string>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>mute</string>
<string>sonos</string>
<key>subtext</key>
<string>Mute Sonos playback</string>
<string></string>
<key>text</key>
<string>Mute Volume</string>
<string>Switch to Main Window</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>5B01F796-DF7B-45DC-941C-7BDFDDE6A2CD</string>
<string>88E93D8B-D7A8-4D62-AFA7-4EE31077D2CA</string>
<key>version</key>
<integer>1</integer>
</dict>
Expand All @@ -529,26 +539,28 @@ end alfred_script</string>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>sonos</string>
<string>mute</string>
<key>subtext</key>
<string></string>
<string>Mute Sonos playback</string>
<key>text</key>
<string>Switch to Main Window</string>
<string>Mute Volume</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>88E93D8B-D7A8-4D62-AFA7-4EE31077D2CA</string>
<string>5B01F796-DF7B-45DC-941C-7BDFDDE6A2CD</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)try tell application "System Events" tell process "Sonos" set frontmost to true click button "Button" of window 1 click menu item "Sonos Controller" of menu 1 of menu bar item "Window" of menu bar 1 end tell end tell return trueon error return falseend tryend alfred_script</string>
<string>---- Switch to Main Window--
on alfred_script(q)try tell application "System Events" tell process "Sonos" set frontmost to true click button "Button" of window 1 click menu item "Sonos Controller" of menu 1 of menu bar item "Window" of menu bar 1 end tell end tell return trueon error return falseend tryend alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
Expand Down Expand Up @@ -706,7 +718,9 @@ fi</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q) tell application "System Events" tell process "Sonos" click button 3 of window 1 end tell end tellend alfred_script</string>
<string>---- Play/Pause--
on alfred_script(q) tell application "System Events" tell process "Sonos" click button 3 of window 1 end tell end tellend alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
Expand Down Expand Up @@ -742,7 +756,9 @@ fi</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q) tell application "System Events" tell process "Sonos" click button 7 of window 1 end tell end tellend alfred_script</string>
<string>---- Toggle Shuffle--
on alfred_script(q) tell application "System Events" tell process "Sonos" click button 7 of window 1 end tell end tellend alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
Expand Down Expand Up @@ -778,7 +794,9 @@ fi</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q) tell application "Sonos" to activate tell application "System Events" to tell process "Sonos" set frontmost to true tell application "System Events" to tell process "Sonos" key code 123 using command down delay 0.2 key code 123 using command down end tell end tellend alfred_script</string>
<string>---- Go to Previous Track--
on alfred_script(q) tell application "Sonos" to activate tell application "System Events" to tell process "Sonos" set frontmost to true tell application "System Events" to tell process "Sonos" key code 123 using command down delay 0.2 key code 123 using command down end tell end tellend alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
Expand Down Expand Up @@ -876,8 +894,8 @@ fi</string>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
tell application "Sonos" to activate tell application "System Events" key code 124 using {command down} end tell
<string>---- Go to Next Track--on alfred_script(q)
tell application "Sonos" to activate tell application "System Events" to tell process "Sonos" delay 1 try key code 124 using {command down} end try end tell
end alfred_script</string>
<key>cachescript</key>
<false/>
Expand Down Expand Up @@ -1135,7 +1153,7 @@ Inspired by Jeff Johns’s [Sonos Sound Controls workflow](https://github.com/ph
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.1.1</string>
<string>0.1.2</string>
<key>webaddress</key>
<string>https://chrismessina.me</string>
</dict>
Expand Down

0 comments on commit 4c59017

Please sign in to comment.