tell application "Reminders"
set newReminder to make new reminder
set name of newReminder to "Text"
set due date of newReminder to current date
end tell
¿Cómo puedo configurar el nombre de newReminder para ingresar texto?
Aquí hay un ejemplo de código AppleScript:
set newReminderName to ""
repeat until newReminderName is not ""
set newReminderName to text returned of (display dialog "Enter a name for the reminder:" buttons {"Cancel", "OK"} default button 2 default answer "" with icon 1)
if newReminderName is not "" then
tell application "Reminders"
set newReminder to make new reminder
set name of newReminder to newReminderName
set due date of newReminder to current date
end tell
end if
end repeat
Esto está codificado para que tenga que ingresar un nombre para el recordatorio o cancelar el aviso. En otras palabras, si no escribe un nombre y hace clic en Aceptar, se le preguntará una y otra vez hasta que lo haga o haga clic en Cancelar.
Actualizado para abordar un punto mencionado en el comentario:
El siguiente código se usa en un servicio de Automator donde el texto seleccionado pasado al servicio de Automator se convierte en el nombre del nuevo recordatorio. Está codificado para no crear el recordatorio si se pasa una picadura vacía. Aunque no creo que pueda activarse a menos que se seleccione algún texto, siempre es mejor incluir algún tipo de comprobación de errores.
on run {input}
set newReminderName to input
if newReminderName is not "" then
tell application "Reminders"
set newReminder to make new reminder
set name of newReminder to newReminderName
set due date of newReminder to current date
end tell
end if
end run
usuario3439894