You are currently viewing audio –  use Applescript to set output sound quantity

audio – use Applescript to set output sound quantity


I need to tweak the Applescript I take advantage of to pick the sound output, to additionally dial the output quantity as much as 100%.

(*
Applescript to toggle between two sound outputs by Line quantity, ¬
as they seem within the Sound Management Panel. Primarily based on code by ¬
Arthur Hammer http://apple.stackexchange.com/a/209434/85275
*)

set inner to 1 --internal audio system
set batcave to three --Bat Cave

inform software "System Preferences"
    activate
    set present pane to pane "com.apple.choice.sound"
finish inform


inform software "System Occasions"
    inform software course of "System Preferences"
        repeat till exists tab group 1 of window "Sound"
        finish repeat
        
        -- I added this line to dial the quantity as much as 100%
        set quantity output quantity 1.0
        
        inform tab group 1 of window "Sound"
            click on radio button "Output"
            if (chosen of row inner of desk 1 of scroll space 1) then
                set chosen of row batcave of desk 1 of scroll space 1 to true
            else
                set chosen of row inner of desk 1 of scroll space 1 to true
            finish if
        finish inform
    finish inform
finish inform
--tell software "System Preferences" to give up
--remove the remark '--' tag above to make the management panel give up afterwards, depart for testing.

The error is:

inform present software
    set quantity «class pcap» "System Preferences" output quantity 1.0
Outcome:
error "System Occasions bought an error: Can’t make software course of "System Preferences" into sort small actual." quantity -1700 from software course of "System Preferences" to small actual

I suppose I am lacking some contextualizing instructions like “inform…” in entrance of the “set column” command. Options?

I am operating MacOS 10.15.7 (Catalina)

Leave a Reply