Monday, October 26, 2020

#1 2020-08-11 09:30:29 am

Fofer
Member
Registered: 2003-04-25
Posts: 5

Muting a grid of streaming videos in QuickTime Player windows

Hi everybody,

I am learning AppleScript and this forum is a treasure trove.  Thanks so much!
My first project is this, I'm opening four video streams in QuickTime Player and placing the windows in a 2x2 grid.  This is the relevant AppleScript, it works great:

Applescript:

tell application "QuickTime Player" to open URL channel1
tell application "QuickTime Player"
   set bounds of front window to {0, 23, 720, 460}
   
end tell


tell application "QuickTime Player" to open URL channel2
tell application "QuickTime Player"
   set bounds of front window to {720, 23, 1440, 460}
   
end tell

tell application "QuickTime Player" to open URL channel3
tell application "QuickTime Player"
   set bounds of front window to {0, 460, 720, 900}
   
end tell

tell application "QuickTime Player" to open URL channel4
tell application "QuickTime Player"
   set bounds of front window to {720, 460, 1440, 900}
   
end tell

What I am stumped on is the AUDIO MUTING part. Ideally I would like 3 of the 4 windows to be muted so only the audio of one window is heard.

I tried invoking the "OPTION-DOWN ARROW" keyboard shortcut, which works when pressed manually inside QuickTime Player. But it doesn't work via this AppleScript, or with many other variations I tried.

Applescript:

tell application "System Events" to tell process "QuickTime Player"
   
   repeat with w in (get every window)
       tell window "QuickTime Player"
           key code 125 using option down
       end tell
   end repeat
   
end tell

I also tried some variations of

Applescript:

set audio volume to "0"

which I thought would be a cleaner way of getting there.
But I couldn't get that working, either.

I'm sure I'm missing something basic, but I'm new to this and still learning.  So thanks for any help you can provide.

Last edited by Fofer (2020-08-11 09:32:02 am)

Offline

 

#2 2020-08-11 10:14:19 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4570

Re: Muting a grid of streaming videos in QuickTime Player windows

Fofer wrote:


Applescript:

tell application "System Events" to tell process "QuickTime Player"
   
   repeat with w in (get every window)
       tell window "QuickTime Player"
           key code 125 using option down
       end tell
   end repeat
   
end tell


Try:

Applescript:

tell application "System Events" to tell process "QuickTime Player"
   set frontmost to true -- ADDED
   repeat with w in (get every window)
       tell window "QuickTime Player"
           key code 125 using option down
       end tell
   end repeat
   
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 11 aout 2020 18:14:13

Offline

 

#3 2020-08-11 10:47:43 am

Fofer
Member
Registered: 2003-04-25
Posts: 5

Re: Muting a grid of streaming videos in QuickTime Player windows

Thank you! That helped a bit, it actually muted the 4th of my four open QT Player windows. Which is great progress, I've never gotten it to do even that.  It also means I'm 1/3 of the way there!

Any help in getting windows 2 and 3 to mute as well would be very much appreciated smile

Offline

 

#4 2020-08-13 10:04:41 am

Fofer
Member
Registered: 2003-04-25
Posts: 5

Re: Muting a grid of streaming videos in QuickTime Player windows

SOLVED.

I got it working with this:

Applescript:

tell application "QuickTime Player"
activate
set every document's audio volume to 0
end tell

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)