Hello,
Mavericks is the OS X I prefer working most of my time in along with Lion. I have High Sierra installed but I rarely use it. However most often than not in Mavericks I experience hangs with Apple’s built-in Script Editor. I made an attempt to single out a clear pattern for this failure to emerge but am not my sure my findings expose the real cause of such misbehaviour. With some scripts Script Editor would freeze regardless of whether it’s an existing script or the one written anew by copy-pasting it to a just started SE document. The following is 2 scenarios that are developing troubles: (1) I make modifications and click “Save” (2) I make modifications compile and then I click “Save” or attempt to quit SE instead. In other cases I’m able to copy-paste, compile and save scripts without problems.
Regarding the script below I wasn’t even able to run it, let alone test, because SE hung.
The script in question (the last one causing me headache) is the following:
property RemindMeDateString : ""
property DueDateString : ""
property DueDate : missing value
property RemindMeDate : missing value
property ReminderName : ""
property ReminderBody : ""
CreateReminderName()
CreateRemindMeDate()
CreateDueDate()
DisplayReminderInfo()
CreateReminderBody()
to CreateRemindMeDate()
repeat
repeat
set DialogReply to display dialog "Set the reminder's date" default answer RemindMeDateString buttons {"Cancel", "Back", "OK"} default button 3 cancel button 1
set RemindMeDateString to text returned of result
if button returned of DialogReply is "OK" then exit repeat
if button returned of DialogReply is "Back" then
display alert "The reminder's date wasn't set!" as warning message "After setting the reminder's name click \"OK\" button in the reminder's name setting dialog window"
CreateReminderName()
end if
end repeat
try
set RemindMeDate to date RemindMeDateString
exit repeat
on error
display alert "Invalid date!" as informational message "The entered date didn't match the system date format. Try again."
try
on error number -128
return
end try
end try
end repeat
end CreateRemindMeDate
to CreateDueDate()
repeat
repeat
set DialogReply2 to display dialog "Set the due date" default answer DueDateString buttons {"Cancel", "Back", "OK"} default button 3 cancel button 1
set DueDateString to text returned of DialogReply2
if button returned of DialogReply2 is "OK" then exit repeat
if button returned of DialogReply2 is "Back" then
display alert "The due date wasn't set!" as warning message "After setting the reminder's date click \"OK\" button of the reminder setting dialog window"
CreateRemindMeDate()
end if
end repeat
try
set DueDate to date DueDateString
exit repeat
on error ErrMessage number ErrNum
display alert "Invalid date!" as informational message "The entered date didn't match the system date format. Try again." buttons {"Cancel", "OK"}
if button returned of result is "Cancel" then error number -128
end try
end repeat
end CreateDueDate
to CreateReminderBody()
repeat
set ReminderBodyPrompt to display dialog "Type a brief description" default answer ReminderBody buttons {"Cancel", "Back", "OK"} default button 3 cancel button 1
if button returned of ReminderBodyPrompt is "New dates" then
CreateRemindMeDate()
CreateDueDate()
DisplayReminderBody()
else
if button returned of ReminderBodyPrompt is "Cancel" then
error number -128
else
exit repeat
end if
end if
end repeat
set ReminderBody to text returned of ReminderBodyPrompt
end CreateReminderBody
to CreateReminderName()
repeat
set ReminderNamePrompt to display dialog "Set the reminder's name" default answer ReminderName buttons {"Cancel", "OK"} default button 2 cancel button 1
if button returned of ReminderNamePrompt is "Cancel" then
error number -128
else
exit repeat
end if
end repeat
set ReminderName to text returned of ReminderNamePrompt
end CreateReminderName
to DisplayReminderInfo()
repeat
set DateInfoDialog to display dialog "The reminder's date: " & RemindMeDateString & return & return & "The due date: " & DueDateString buttons {"Cancel", "New dates", "OK"} default button 3 cancel button 1
if button returned of DateInfoDialog is "New dates" then
CreateRemindMeDate()
CreateDueDate()
CreateReminderBody()
DisplayReminderInfo()
else
if button returned of DateInfoDialog is "Cancel" then
error number -128
else
exit repeat
end if
end if
end repeat
end DisplayReminderInfo
tell application "Reminders"
run
set AllAccounts to (get name of every account)
set AccountName to (choose from list AllAccounts with title "iCloud accounts" with prompt "Select one account." default items {"iCloud 2"} without multiple selections allowed) as text --this condition reflects the fact that I have 2 iCloud accounts with the «Reminders» application.
set SelectedAccount to (get account named AccountName)
set AllLists to (get name of every list of SelectedAccount)
set ListName to (choose from list AllLists with title "Lists of the account" & quote & AccountName & quote & "." with prompt "To create a reminder select one list." default items {"Personal (local)"} without multiple selections allowed) as text --the default list is the one I have in my iCloud account.
tell (list named ListName)
set NewReminder to make new reminder with properties {name:ReminderName, remind me date:RemindMeDate, due date:DueDate, body:ReminderBody} at the end of it
end tell
display dialog "Setting is complete. \"Reminders\" quitting" giving up after 2 buttons {"OK"} default button "OK"
quit
end tell