views:

26

answers:

1

Hi, I'm new to the world of Applescript! I'm trying to figure out how to find into a specific calendar events that contains certain words. In particular, I don't know how to make a repeat that find certain word in the calendar's events...

Thanks in advance

A: 

There's a MacTech tutorial here which includes a search example: http://www.mactech.com/articles/mactech/Vol.21/21.11/ScriptingiCal/index.html

Here's a working example of how you might find calendar events that match a search criterion:

tell application "iCal"
    tell calendar "Domestic"
        set theEventList to every event whose summary contains "Recycling"
    end tell
    set theEvent to first item of theEventList
    return summary of theEvent
end tell

This example works for me. It finds all events in my "Domestic" calendar which contain the term "Recycling" and then returns the summary of the first one in this list.

Paul R
Thanks, but I don't want to get the uid of the event, but a summary of the events with the word...
guglio
@guglio: look at the MacTech example and my example above - you can iterate through events and look at the text returned in "summary" and match it against whatever you are searching for.
Paul R
I tried this:tell application "iCal" tell calendar "Home" set theEvent to every event whose summary = "word" return summary of theEvent end tellend tellbut this return error 1728
guglio
@guglio: I've updated the example above again and it should now hoepfully be closer to what you want to do.
Paul R
Thanks a lot!!!! This script work perfectly!!!!
guglio