Forked from ybbond/Toggle Safari Mute.applescript
Last active
August 29, 2023 12:54
-
-
Save mkozjak/d32ea2de1f99ca083fc536a97ff63e6c to your computer and use it in GitHub Desktop.
Revisions
-
mkozjak renamed this gist
Aug 29, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mkozjak revised this gist
Aug 21, 2023 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,11 +37,7 @@ on error pipErrMsg end tell delay 0.2 click menu item "Enter Picture in Picture" of menu 1 of group 3 of toolbar 1 of window tabName end tell end tell -
mkozjak revised this gist
Aug 21, 2023 . 1 changed file with 45 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,42 +1,55 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso, Mario Kozjak # dCre: 2021-07-11 20:18 # dMod: 2023-08-19 15:51 # Appl: System Events, PIPAgent, Safari # Task: Toggle Picture in Picture (PiP) on and off # Libs: None # Osax: None # Aojc: True # Tags: @Applescript, @Script, @System_Events, @PictureInPicture, @PiP, @Safari # Vers: 1.05 -------------------------------------------------------------------------------- try if application "PIPAgent" is running then tell application "System Events" click button 3 of window "PIP" of application process "PIPAgent" end tell else error "Can’t get application process" end if on error pipErrMsg if pipErrMsg contains "Can’t get application process" or pipErrMsg contains "Can’t get window" then try tell application "Safari" set docItem to first item of documents set tabName to name of docItem end tell tell application "System Events" tell application process "Safari" set aWindow to window 1 tell application "System Events" perform action "AXShowMenu" of button 2 of UI element tabName of UI element 1 of group 3 of toolbar 1 of aWindow end tell delay 0.2 keystroke "Down" keystroke "Down" keystroke return -- click menu item "Enter Picture in Picture" of menu 1 of group 3 of toolbar 1 end tell end tell do shell script "killall System\\ Events" on error safariErrMsg return "Error Level::Safari:" & space & safariErrMsg end try else return "Error Level::PIP Agent:" & space & pipErrMsg end if end try -
ybbond revised this gist
Jul 13, 2021 . 1 changed file with 12 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso # dCre: 2021-07-11 20:52 # dMod: 2021-07-13 19:57 # Appl: System Events, Safari # Task: Toggle Picture in Picture (PiP) on and off # Libs: None # Osax: None # Aojc: None # Tags: @Applescript, @Script, @System_Events, @Safari, @Mute # Vers: 1.01 -------------------------------------------------------------------------------- try @@ -19,32 +19,24 @@ try end tell tell application process "Safari" tell window tabName try tell button 3 of group 4 of toolbar 1 perform action "AXShowMenu" end tell if exists (menu item "Mute This Tab" of menu 1 of group 4 of toolbar 1) then click menu item "Mute This Tab" of menu 1 of group 4 of toolbar 1 else if exists (menu item "Unmute This Tab" of menu 1 of group 4 of toolbar 1) then click menu item "Unmute This Tab" of menu 1 of group 4 of toolbar 1 end if on error toolbarErrMsg return "Error Level::Toggle Mute:" & space & toolbarErrMsg end try end tell end tell end tell do shell script "killall System\\ Events" on error errMsg return "Error Level::Top:" & space & errMsg end try -
ybbond revised this gist
Jul 11, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso # dCre: 2021-07-11 20:52 # dMod: 2021-07-11 20:52 # Appl: System Events, Safari # Task: Toggle Picture in Picture (PiP) on and off # Libs: None # Osax: None # Aojc: None # Tags: @Applescript, @Script, @System_Events, @Safari, @Mute # Vers: 1.00 -------------------------------------------------------------------------------- try -
ybbond created this gist
Jul 11, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso # dCre: 2021-07-11 20:18 # dMod: 2021-07-11 20:50 # Appl: System Events, Safari # Task: Toggle Picture in Picture (PiP) on and off # Libs: None # Osax: None # Aojc: None # Tags: @Applescript, @Script, @System_Events, @Safari, @Mute # Vers: 1.02 -------------------------------------------------------------------------------- try tell application "System Events" tell application "Safari" set docItem to first item of documents set tabName to name of docItem end tell tell application process "Safari" tell window tabName try tell button 2 of radio button tabName of group "tab bar" perform action "AXShowMenu" end tell tell menu item 1 of menu 1 of button 2 of radio button tabName of group "tab bar" perform action "AXPress" end tell on error winErrMsg if winErrMsg contains "Can’t get group" then try tell button 3 of group 4 of toolbar 1 perform action "AXShowMenu" end tell tell menu item 1 of menu 1 of group 4 of toolbar 1 perform action "AXPress" end tell on error toolbarErrMsg return "Error Level::Toggle Mute from Tool Bar:" & space & toolbarErrMsg end try else return "Error Level::Toggle Mute from Tab Bar:" & space & winErrMsg end if end try end tell end tell end tell on error errMsg return "Error Level::Top:" & space & errMsg end try