2 votos

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

Soy un OS X principiante .

Tengo un Applescript configurado para que se ejecute en el arranque y en lugar de ejecutarse 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 puedo eliminar esto para que la aplicación se ejecute sin problemas?

El siguiente archivo fue guardado 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

3voto

Seif Puntos 121

Abre tu script en el editor de script. Haz un Guardar como... (mantén pulsada la tecla Opción y "Duplicar" en el menú Archivo cambiará a "Guardar como...").

Cuando guardes tu script como aplicación esta vez, asegúrate de que la casilla que dice "Mostrar pantalla de inicio" no esté marcada. Vea mi captura de pantalla.

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

AppleScript save as application without Startup Screen

1voto

user3439894 Puntos 5883

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 de código que rodea a Código clave de los eventos del sistema y retraso puede condensarse en 14 líneas de código utilizando 3 Repita declaraciones en total. Configurar un repetir 10 veces declaración para cada código clave y un repetir 3 veces declaración que lo 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

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