Last active
March 5, 2025 14:36
-
-
Save ybbond/47d6fce6ce500748a0cfb7841cd0c64b to your computer and use it in GitHub Desktop.
Revisions
-
ybbond revised this gist
Jul 13, 2021 . 1 changed file with 8 additions and 17 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:18 # dMod: 2021-07-13 20:01 # 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.04 -------------------------------------------------------------------------------- try @@ -28,25 +28,16 @@ on error pipErrMsg end tell tell application "System Events" to tell application process "Safari" tell window tabName try tell button 3 of group 4 of toolbar 1 perform action "AXShowMenu" end tell click menu item "Enter Picture in Picture" of menu 1 of group 4 of toolbar 1 on error toolbarErrMsg return "Error Level::Toggle PiP:" & space & toolbarErrMsg end try end tell end tell do shell script "killall System\\ Events" -
ybbond revised this gist
Jul 11, 2021 . 1 changed file with 11 additions and 12 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,26 +1,24 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso # dCre: 2021-07-11 20:18 # dMod: 2021-07-11 21:07 # 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.03 -------------------------------------------------------------------------------- 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 @@ -51,6 +49,7 @@ on error pipErrMsg end try end tell end tell do shell script "killall System\\ Events" on error safariErrMsg return "Error Level::Safari:" & space & safariErrMsg end try -
ybbond revised this gist
Jul 11, 2021 . 1 changed file with 1 addition and 1 deletion.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 @@ -6,7 +6,7 @@ # Task: Toggle Picture in Picture (PiP) on and off # Libs: None # Osax: None # Aojc: None # Tags: @Applescript, @Script, @System_Events, @PictureInPicture, @PiP, @Safari # Vers: 1.02 -------------------------------------------------------------------------------- -
ybbond revised this gist
Jul 11, 2021 . 1 changed file with 10 additions and 4 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,19 +1,25 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso # dCre: 2021-07-11 20:18 # dMod: 2021-07-11 20:50 # 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.02 -------------------------------------------------------------------------------- try tell application "System Events" if exists (window "PIP" of application process "PIPAgent") then tell application process "PIPAgent" to tell window "PIP" click button 3 end tell else error "Can’t get application process PIPAgent" end if end tell on error pipErrMsg if pipErrMsg contains "Can’t get application process" or pipErrMsg contains "Can’t get window" then -
ybbond revised this gist
Jul 11, 2021 . 1 changed file with 13 additions and 0 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,3 +1,16 @@ -------------------------------------------------------------------------------- # Auth: Yohanes Bandung Bondowoso # dCre: 2021-07-11 20:18 # dMod: 2021-07-11 20:24 # 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.01 -------------------------------------------------------------------------------- try tell application "System Events" to tell application process "PIPAgent" to tell window "PIP" click button 3 -
ybbond revised this gist
Jul 11, 2021 . 1 changed file with 32 additions and 44 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,53 +1,41 @@ try tell application "System Events" to tell application process "PIPAgent" to tell window "PIP" click button 3 end tell 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" to tell application process "Safari" tell window tabName try tell button 2 of radio button tabName of group "tab bar" perform action "AXShowMenu" end tell click menu item "Enter Picture in Picture" of menu 1 of button 2 of radio button tabName of group "tab bar" 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 click menu item "Enter Picture in Picture" of menu 1 of group 4 of toolbar 1 on error toolbarErrMsg return "Error Level::Toggle Mute from Tool Bar:" & space & toolbarErrMsg end try else return "Error Level::Toggle PiP from Tab Bar:" & space & winErrMsg end if end try end tell end tell on error safariErrMsg return "Error Level::Safari:" & space & safariErrMsg end try else return "Error Level::PIP Agent:" & space & pipErrMsg end if end 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,53 @@ try tell application "System Events" try tell application process "PIPAgent" to tell window "PIP" tell button 3 perform action "AXPress" end tell end tell 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 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 "Enter Picture in Picture" 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 "Enter Picture in Picture" 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 PiP from Tab Bar:" & space & winErrMsg end if end try end tell end tell on error safariErrMsg return "Error Level::Safari:" & space & safariErrMsg end try else return "Error Level::PIP Agent:" & space & pipErrMsg end if end try end tell on error errMsg return "Error Level::Top:" & space & errMsg end try