2 votos

Activar el bluetooth a través de la línea de comandos/terminal

¿Cómo puedo activar el bluetooth a través del terminal / la línea de comandos?

1voto

Arne Puntos 928

Hay una respuesta en Superusuario . El último post es el que mejor me ha funcionado, en una forma ligeramente diferente. El 'checkbox "On"' no me funcionó, pero el siguiente código sí:

# This is only necessary, if AppleScripts are not yet allowed to change checkboxes
tell application "System Events" to set UI elements enabled to true
# Now change the bluetooth status
tell application "System Preferences"
    set current pane to pane id "com.apple.preferences.bluetooth"
    tell application "System Events"
        tell process "System Preferences"
            # Enabled is checkbox number 2
            if value of checkbox 2 of window "Bluetooth" is 0 then
                click checkbox 2 of window "Bluetooth"
            end if
        end tell
    end tell
    quit
end tell

Puedes ejecutar este script utilizando osascript .

Actualización: Ahora he cambiado el script para que sólo active el Bluetooth. Ya no hay que alternar.

AppleAyuda.com

AppleAyuda es una comunidad de usuarios de los productos de Apple en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X