AppleScript: Declaración del controlador de llamadas dentro de Tell
-
29-10-2019 - |
Pregunta
Recibo este error cada vez que ejecuto este script: los eventos del sistema reciben un error: "test123" no comprende el mensaje de notificación.
Código:
--more code...
tell application "System Events"
if some_system_events_property then
my notify of "Test123" thru "Test"
end if
end tell
--more code...
to notify of message thru level
display dialog message with titel level
end notify
He intentado reemplazar
my notify of "Test123" thru "Test"
con lo siguiente, sin ningún éxito:
notify of "Test123" thru "Test" of me
(notify of "Test123" thru "Test") of me
Solución
Prueba esto:
tell application "System Events"
if some_system_events_property then
tell me to notify of "Test123" thru "Test"
end if
end tell
to notify of message thru level
display dialog message with title level
end notify
Aunque también diré que nunca uso la sintaxis de parámetros directos para los manejadores AppleScript, prefiriendo parámetros posicionales (es decir, notify( message, level )
), ya que evita los problemas de sintaxis ambiguos que descubrió.
Otros consejos
No estoy exactamente seguro de lo que está tratando de hacer, pero aquí hay un ejemplo de cómo llamar a una función y pasar el parámetro
tell application "System Events"
set m to "message content"
my notify(m)
end tell
--more code...
on notify(message)
display dialog (message)
end notify
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow