IPB

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> Aide AppleScript pour sélectionner la sortie son, Une ligne vous manque et ...
Options
agon
posté 15 Aug 2011, 12:33
Message #1


Macbidouilleur de vermeil !
****

Groupe : Membres
Messages : 1 336
Inscrit : 7 Sep 2001
Membre no 753



Bonjour,

Voilà, j'ai mon mac qui s'obstine à vouloir mettre la sortie son sur mes écouteurs aux lieu des haut-parleurs.
Qu'à cela ne tienne, je me dis qu'un AppleScript fera l'affaire.
Première os, on ne peut enregistrer les actions dans l'application "Préférences".
Pas grave, une recherche sur internet et je trouve un petit script bien sympa. Bon en anglais, j'ai du retravailler un peu et ça donne ceci :
Code
tell application "System Preferences" to activate
tell application "System Events"
    get properties
    tell process "System Preferences"
        click menu item "Son" of menu "Présentation" of menu bar 1
        set theRows to every row of table 1 of scroll area 1 of tab group 1 of window "son"
        set theOutputs to {} as list
        repeat with aRow in theRows
            if (value of text field 1 of aRow as text) is equal to "Haut-parleurs internes" then
                set selected of aRow to true
                exit repeat
            end if
        end repeat
    end tell
end tell
tell application "System Preferences" to quit


Bien joli, mais il manque une chose, la sélection du bouton "Sortie" juste après celui de "Son"
Quelqu'un saurait-il me dire comment écrire cette fichue instruction?

Merci d'Avance
Go to the top of the page
 
+Quote Post
Guest_EricaL**_*
posté 15 Aug 2011, 17:23
Message #2





Guests






Bonjour,

Ce script sélectionne le bouton "Sortie".

Code
-- sélectionne le panneau "Son" et l'onglet "Sortie"
tell application "System Preferences" to reveal anchor "output" of pane id "com.apple.preference.sound"

tell application "System Events" to tell table 1 of scroll area 1 of tab group 1 of window 1 of process "System Preferences"
    select (first row whose value of text field 1 is "Haut-parleurs internes") -- sélectionne la sortie "Haut-parleurs internes"
end tell
quit application "System Preferences"
Go to the top of the page
 
+Quote Post
agon
posté 16 Aug 2011, 10:14
Message #3


Macbidouilleur de vermeil !
****

Groupe : Membres
Messages : 1 336
Inscrit : 7 Sep 2001
Membre no 753



Merci,

Je teste ça ce soir smile.gif
Go to the top of the page
 
+Quote Post
agon
posté 17 Aug 2011, 20:23
Message #4


Macbidouilleur de vermeil !
****

Groupe : Membres
Messages : 1 336
Inscrit : 7 Sep 2001
Membre no 753



Nickel,

Merci Erical**
Go to the top of the page
 
+Quote Post
sansnom
posté 25 Feb 2012, 15:02
Message #5


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 146
Inscrit : 30 Jun 2005
Lieu : Loiret
Membre no 41 715



Superbe, merci...


--------------------
MacMini M1 (13.4.1c) 16Go • iPhone 11 Pro Max 64Go • iPadMini Wi-Fi 6ème Gén. 64Go • aTV 4K 32Go
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



Nous sommes le : 16th April 2024 - 06:27