If you click on AppleScript | Mac OS X, and read the heading of this thread, you’ll discover that you spelled Nigel’s name as NIgal. ![]()
Not that I think he would care about it, because then he’d said something, but it is a heading afterall.
If you click on AppleScript | Mac OS X, and read the heading of this thread, you’ll discover that you spelled Nigel’s name as NIgal. ![]()
Not that I think he would care about it, because then he’d said something, but it is a heading afterall.
Okay,
Basically, in the calendar “Work” there are multiple repeating events called “Working”, they never overlap, I just want it to return the start time of the next event “Working”. Sorry if these has been explained but I’ve lost where we are up to.
Apologies
Now I get it. The a! You’re funny McUsr. ![]()
I didn’t mean to be funny.
I generally doesn’t care much about spelling of names, unless there is some danger of taking one person for the other, but it looks alot better, if names are spelled correctly in the headings of threads.
Don’t you think?
Hi JWalker1995,
Have you ever seen what the data for an event looks like?
Editted: I meant a Calendar ‘Event’.
kel
Hi JWalker1995,
Have you ever seen what the data for an event looks like?
kel
Sorry, maybe I didn’t make it clear, I know it will return in the form 'DD MonthName YYYY HH:MM:SS" but I have my own code to strip it down to the parts I need, so the returned date can be in any format you guys like ![]()
Thanks
Edit: sorry yes, I’m filtering by summary, and then returning the start date, in the form above^
First you need to parse the info. Then, you need to calculate when the next occurrence will happen relative to the current date. The parsing part is the hard part, its trying to know what the text means. You can look in your library and open one of the Calendar files. That ws another way to do it, but you needed to restart afterwards, I don’t know if you still need to restart now.
First you need to parse the info. Then, you need to calculate when the next occurrence will happen relative to the current date. The parsing part is the hard part, its trying to know what the text means. You can look in your library and open one of the Calendar files. That ws another way to do it, but you needed to restart afterwards, I don’t know if you still need to restart now.
Yeah, I have a working solution from StefanK using his command line code, I just need help on it so it reads multiple re-occurring events with the same summary.
Thanks
Okay,
Basically, in the calendar “Work” there are multiple repeating events called “Working”, they never overlap, I just want it to return the start time of the next event “Working”. Sorry if these has been explained but I’ve lost where we are up to.
Apologies
So, to be absolutely clear, do you want:
In my calendar “Work” I have 3 repeating events (all called “Working”) 1 on Wednesdays, 1 Friday, 1 Sunday
I want the code to output the date and start time of the next event in the calendar, so as today is Thursday, it would output " 24th May 2013 HH:MM:SS" as the next event is the Friday one.
However, the days and times of these events are subject to change, and extra events might be added, for example one week I could work my 3 standard days, but then work extra on two different days, so the output would have to reflect that ![]()
To make it easier the events will not overlap.
Pease feel free to ask any more questions
Thanks
If you have one event which repeats on Wednesdays, another on Fridays, and another on Sundays, the repeats are bound to overlap.
I came late to the thread but where is the script everyone is talking about?
Ahh my mistake, I thought you meant the events overlapping not the repeats, in that case, then yes, the repeats will overlap.
Thanks
I came late to the thread but where is the script everyone is talking about?
Wow! My finger is sore from all of the scrolling!
Ahh my mistake, I thought you meant the events overlapping not the repeats, in that case, then yes, the repeats will overlap.
It can be a bit confusing terminologywise. An event which repeats is just one event. It has one start date (its first expression in the calendar display) and that’s what Calendar returns to the script. Repeats are calculated on the fly by Calendar and displayed in the appropriate places. A script to get the expression dates of the repeats has to do the same thing ” calculate them according to rules which can be very simple or very complex, depending on how the repeat sequence is specified and on whether any of the repeat instances have been altered, moved to different times, or deleted in Calendar’s GUI. That’s what the script in the other thread does.
When you talk about ‘next “Work” event’, I need to be sure whether you actually mean ‘next “Work” event’ or ‘next expression of a “Work” event.’ I think you mean the latter, in which case the script in the other thread, run with the either of the code samples in post #11 above, should produce the results you want.
Hi, i think i mean the next expression of a work event as the event itself started in march 2012.
I’ve included a screenshot of my calendar so you can hopefully visualise it more. Each of these events it a recurred from march 2012 when it was first set ![]()

i hope this allows you to understand what i mean. and a final run of the code would be great as i got lost to where were up to so have all manner of code mixed together
many thanks
James
EDIT: yes i’m at work at the min, this is beign run on my mac at home though ![]()
and a final run of the code would be great as i got lost
-- The script at <http://macscripter.net/viewtopic.php?pid=114724#p114724> goes here.
-- Replace the last six, commented-out lines with the following:
tell application "Calendar" to set {allSummaries, allEventUIDs} to {summary, uid} of (every event of calendar "Work")
set checkDate to (current date)
set nextIterationDate to missing value
repeat with i from 1 to (count allSummaries)
if (item i of allSummaries is "Working") then
set thisIteration to (getNextRecurrence from checkDate for (item i of allEventUIDs) without straddle)
if ((thisIteration is not missing value) and ((nextIterationDate is missing value) or (thisIteration's |start date| comes before nextIterationDate))) then set nextIterationDate to thisIteration's |start date|
end if
end repeat
return nextIterationDate -- Returns an AppleScript date object.
The script assumes that the target calendar is stored on the startup volume in the normal location for the version of iCal/Calendar used. If not, it won’t work.
Your Calendar looks slightly different from mine. Is it the Lion version?
Many thanks, ill try this when I get home and let you know if it works ![]()
That version of the calendar looks different because it is the online iCloud.com version as I don’t have access to my Mac at home while at work
I’m running ML at home though
Thanks again
Edit: Ignore What Was Written Here