• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
assigning properties of an object in a loop, in a tell block
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

assigning properties of an object in a loop, in a tell block


  • Subject: assigning properties of an object in a loop, in a tell block
  • From: Alex Hall <email@hidden>
  • Date: Sun, 23 Jun 2013 20:35:47 -0400

Hi all,
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!



Have a great day,
Alex (msg sent from Mac Mini)
email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: add contact to carddav with applescript
  • Next by Date: Re: assigning properties of an object in a loop, in a tell block
  • Previous by thread: Re: add contact to carddav with applescript
  • Next by thread: Re: assigning properties of an object in a loop, in a tell block
  • Index(es):
    • Date
    • Thread