I am still working on my set of scripts to quickly speak information for those using Voiceover on the Mac (or those who just like to have things spoken). The current script is one to speak overdue reminders. Here's the basic setup:
tell application "Reminders"
set rl to reminders whose (completed is false) and (due date < (current date)) #that works fine
if length of rl > 0 then #extract all information
repeat with r in rl
#a bunch of lines to set each property of "r", a reminder in the list, to local variables to be returned
#add a new record to a list of records storing the information we just assigned to all those local variables
end repeat
end tell
return the list of records for the calling method to parse further
I get nothing but errors. Often, they are about Applescript being unable to convert class "remi", then the reminder's unique ID, to the expected type. I keep moving the end tell around, adding and removing "my" in the for loop where I assign the properties to my own variables, and so on, but nothing works. My latest error is great: "Apple event handler failed." That's the whole message - no details, no nothing, and the error code is, not surprisingly, -10000.
So, I'm wondering a couple things.
1. Is there an easier way to grab every property of an object like this than what I'm doing? For every reminder, I do
set my body to body of r
set my name to name of r
and so forth.
2. If not, why do I get so many errors as soon as tell blocks enter into the equation? I never had this much trouble with my scripts, most of which rely on scraping from shell command results, until I started using tells. What's the key to get them to work consistently? Is there a trick with placement? The "my" keyword? Anything?
Thanks in advance. Also, thanks to all of your help in the past, I was able to release a beta version of all my scripts this morning (needless to say, the reminders one didn't make it in), so that's exciting. So far, only one small error was reported, which I fixed, so it looks like a short beta cycle!