• 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
Outlook 2011 script to get 'next meeting'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Outlook 2011 script to get 'next meeting'


  • Subject: Outlook 2011 script to get 'next meeting'
  • From: "David A. Cox" <email@hidden>
  • Date: Fri, 19 Nov 2010 22:30:51 +0000
  • Thread-topic: Outlook 2011 script to get 'next meeting'

I have an applescript app that can take advantage of where I am likely to
be going. I have used iCal as the source of that info in the past, but the
now that Outlook exists for the Mac in a reasonable way, I have need for
that info from that source as well.

I have included below a version of my script that simply returns the
location and title of the next meeting in a set of specified Outlook
calendars (as long as the meeting is within a time frame you are
interested in). The script seems to work in my limited testing, but it
seems slow. I wanted to share the script to get it into the archive, in
case it ends up being of any use to anyone else, and also to see if anyone
has any quick thoughts about how to speed it up, or improve it in any
other way.

Anyway, here is what is working for me:

set Cals2Check to "Calendar, Home"
set curdate to current date
set outsidedate to (curdate + 900) --The number at the end determines how
many seconds to look into the future for a meeting

set delims to AppleScript's text item delimiters
if Cals2Check contains ", " then
 set AppleScript's text item delimiters to {", "}
else
 set AppleScript's text item delimiters to {","}
end if
set caltitles to every text item of Cals2Check
set AppleScript's text item delimiters to delims

tell application "Microsoft Outlook"

 --We need to get the ID of each calendar, as the names are not always
unique (this may be an issue with mounted shared calendars)
 set calIDs to {}
 repeat with i from 1 to number of items in caltitles
  set caltitle to item i of caltitles
  set calIDs to calIDs & (id of every calendar whose name is caltitle)
 end repeat


 --Now we get a list of events from each of the calendar that match our
time criteria
 set calEvents to {}
 repeat with i from 1 to number of items in calIDs
  set CalID to item i of calIDs

  tell (calendar id CalID)
   set calEvents to calEvents & (every calendar event whose (start time >
(curdate - 300)) and (start time < (outsidedate)))
  end tell

 end repeat


 --we grab the "next" calendar event
 set nextEventTitle to {}
 repeat with i from 1 to number of items in calEvents
  if nextEventTitle is {} then
   set nextEventTitle to item i of calEvents
  else
   if start time of item i of calEvents is less than start time of item 1
of nextEventTitle then
    set nextEventTitle to item i of calEvents
   end if
  end if

 end repeat


 if nextEventTitle is not {} then

  set MeetingLocation to location of item 1 of nextEventTitle
  if MeetingLocation is missing value then
   set MeetingLocation to "?"
  end if
  set MeetingTitle to subject of item 1 of nextEventTitle

  return "I am at " & MeetingLocation & " for " & MeetingTitle
 else
  return "No meeting in the time frame specified"

 end if

end tell






 _______________________________________________
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: [ANN] 'AppleScriptObjC Explored' Errata and Addenda
  • Next by Date: Checking unread email account in Mail.app and Outlook 2011
  • Previous by thread: [ANN] 'AppleScriptObjC Explored' Errata and Addenda
  • Next by thread: Checking unread email account in Mail.app and Outlook 2011
  • Index(es):
    • Date
    • Thread