¿Cómo deshacerse de la confirmación de Applescript?

2

Soy un principiante de OS X .

Tengo un conjunto de AppleScript para ejecutarse en el arranque y, en lugar de ejecutarlo automáticamente, tengo que activar el script con una confirmación de ejecución:

"Press Run to run this script, or Quit to quit"

¿Cómo me deshago de esto para que la aplicación se ejecute sin problemas?

El siguiente archivo se guardó como una aplicación.

tell application "Finder"
    activate
    tell application "Finder" to set pathToSound to (((path to me) & "Contents:Resources:TardisTakeoff.m4a") as string) as alias

    tell application "QuickTime Player" to play (open pathToSound)
end tell

tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 107
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)
tell application "System Events"
    key code 113
end tell
delay (0.1)

quit me
    
pregunta Nosa Lawani 12.07.2016 - 22:16

2 respuestas

2

Abre tu script en el Editor de Script. Haga un Guardar como ... (mantenga presionada la tecla Opción y "Duplicar" en el menú Archivo cambiará a "Guardar como ...").

Cuando guarde su script como una aplicación esta vez, asegúrese de que la casilla que dice "Mostrar pantalla de inicio" no esté marcada. Ver mi captura de pantalla.

Eso es todo lo que hay que hacer. Su script anterior se guardó con la opción "Mostrar pantalla de inicio" marcada. ¡Ahora sabes lo que hace esa opción!

    
respondido por el Christian Boyce 13.07.2016 - 07:52
1

Esto no pretende ser una respuesta a tu pregunta, es un ejemplo de cómo mejorar tu código .

Después de revisar su código , las 240 líneas del código que rodean el código de clave de eventos del sistema y el retraso pueden condensado en 14 líneas de código usando 3 declaraciones repetidas en total. Configure una declaración de repetir 10 veces para cada código clave y una declaración de repetir 3 veces que la rodea.

Ejemplo:

repeat 3 times
    repeat 10 times
        tell application "System Events"
            key code 107
        end tell
        delay (0.1)
    end repeat
    repeat 10 times
        tell application "System Events"
            key code 113
        end tell
        delay (0.1)
    end repeat
end repeat
    
respondido por el user3439894 13.07.2016 - 14:20

Lea otras preguntas en las etiquetas