[Date Prev][Date
Next][Thread Prev][Thread Next][Date
Index][Thread Index]
Re: HV Integration with Outlook etc?
- To: ukha_d@xxxxxxx
- Subject: Re: HV Integration with Outlook etc?
- From: "Paul Gordon" <paul_gordon@xxxxxxx>
- Date: Tue, 01 Jan 2002 22:48:54 +0000
- Delivered-to: mailing list ukha_d@xxxxxxx
- Mailing-list: list ukha_d@xxxxxxx; contact
ukha_d-owner@xxxxxxx
- Reply-to: ukha_d@xxxxxxx
Nah Bollocks - forget Thursday - I've managed to dig it out now....
Here is the script I wrote when I was testing the functionality....
<START CLIP>
'*********************************************************************************************************************
'* Daily alarm script
'*
'* Author: Paul Gordon (paul_gordon@xxxxxxx)
'*
'* Description:
'*
'* This script is designed as a daily wake-up alarm, with a few smart
features derived from integration with an outlook
'* 2000 calendar. (Note: I have only tested it with Outlook 2000, it may or
may not work with other versions - YMMV)
'* It does the following:
'*
'* Opens a connection to Outlook 2000 - If outlook is not already running
on
the PC, it will launch it, so It's advisable
'* to NOT use the "Prompt for profile" option of outlook, -
otherwise the
script will stall, (and eventually time-out)
'*
'* Finds all of the appointments and events on todays calendar (if any)
'*
'* Checks to see if any of those calendar items are "Holiday",
and if so,
immediately terminates (no alarm on holiday!)
'*
'* Sorts appointments which have start times into time order (not yet
implemented this feature)
'*
'* Speaks all todays appointments in the correct order, with all-day events
listed first.
'*
'*********************************************************************************************************************
sub main()
Dim objOutlook
Dim objNameSpace
Dim objFolder
Dim MyItems
Dim CurrentItem
Dim strOutput(10)
dim today
dim itemdate
dim itemlocation
dim itemcount
dim itemtime
dim itemhour
dim itemmins
dim holiday
Const olTaskItem = 3
Const olFolderCalendar = 9
today=left(date, 10)
itemcount=0
s=hs.execx10("w2", "off", 0, 0)
'*********************************************************************************************************************
'Create Outlook, Namespace, Folder Objects and calendar Item, and then read
all calendar items into a collection.
Set objOutlook = CreateObject("Outlook.application")
Set objNameSpace = objOutlook.GetNameSpace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderCalendar)
Set MyItems = objFolder.Items
'*********************************************************************************************************************
'Loop through all items with a Date of Today.
For Each CurrentItem in MyItems
itemdate=left(CurrentItem.Start,10)
if len(CurrentItem.Start) = 19 then
itemtime=mid(CurrentItem.Start, 12, 5)
itemhour=left(itemtime, 2)
if itemhour > 12 then itemhour=itemhour-12
itemmins=right(itemtime, 2)
if itemmins="00" then itemmins="O clock"
itemtime=itemhour & " " & itemmins & ", "
end if
itemlocation=CurrentItem.location
if itemdate=today then
itemcount=itemcount+1
strOutput(itemcount) = CurrentItem.Subject
if trim(lcase(CurrentItem.Subject)) = "holiday" then holiday=1
if itemlocation > "" then strOutput(itemcount) =
strOutput(itemcount) & "
at " & itemlocation
if len(CurrentItem.Start) = 19 then strOutput(itemcount) = itemtime &
strOutput(itemcount)
' Note: the Currentitem.Start field contains EITHER a date AND time (for
appointments), OR a date ONLY, (for all-day events).
' The date field is always padded with leading zeroes if required, to
ensure
a DD/MM/YY format. Similarly, the
' time field is also padded to a HH:MM format, - so it always = 19
chraracters for appointments with start times.
end if
Next
'*********************************************************************************************************************
'sort appointments into time order. (haven't written this bit yet)
'---------------------------------
'*********************************************************************************************************************
'check if I am on holiday today.
'------------------------------
'Note: the script only checks for the word "holiday" on a single
entry with
no start or end time.
'Therefore, if you want the script to know you are on holiday, you must
enter an "all day event" (no start time),
'in your Outlook Calendar, with the word "holiday" as the
subject. (case
does not matter, nor do spaces), but do not
'put any other words in the SUBJECT line of the calendar entry. - you may
fill in location etc. the script does not
'check any other fields.
if holiday then
'Put in here what you want to happen if today is marked as a holiday.
'(in my case, I want to abort the script, and not sound my wake-up alarm)
hs.writelog "Outlook test", "Today is a holiday (according
to Outlook
Calendar), so cancelling alarm..."
exit sub
end if
'*********************************************************************************************************************
'Speak results to user, if any.
'-----------------------------
'Open a COM session to Winamp (Requires the WinampCOM plugin installed -
available from www.winamp.com)
set WinAMP = CreateObject("WinampCOM.Application")
wstat="unknown"
t=WinAMP.status
if t=1 then 'winamp is currently playing
wstat="playing"
winamp.pause 'pause command is only issued if it is currently playing
end if
'hs.waitevents()
If itemcount > 0 Then
If itemcount = 1 Then hs.speak "There is 1 item on your calendar for
today"
If itemcount > 1 Then hs.speak "There are " & itemcount
& " items on your
calendar for today"
for a=1 to itemcount
hs.waitsecs 1
hs.speak strOutput(a)
next
Else
hs.speak "You have no entries in your calendar for today"
End If
if wstat="playing" then 'if winamp was playing before...
winamp.play
end if
hs.waitsecs 2
'Clean up
Set objFolder = Nothing
Set objNameSpace = Nothing
set objOutlook = Nothing
s=hs.execx10("w2", "on", 0, 0)
end sub
<END CLIP>
>From: "P G" <psghome@xxxxxxx>
>Reply-To: ukha_d@xxxxxxx
>To: homevision-users@xxxxxxx, ukha_d@xxxxxxx
>Subject: [ukha_d] HV Integration with Outlook etc?
>Date: Tue, 01 Jan 2002 20:03:20 +0000
>
>Just thinking about automating wakeup schedules etc and thought it
might be
>good to be able to query an app such as Outlook to see if an event
exists
>on
>the relevant day like 'on holiday at home'.
>I guess an easier way would be to interactively set a wakeup each
evening
>depending on what is to happen the next morning and at what time.
>
>Has anyone looked at doing this/done it? Is the outlook link something
that
>could be easily achived?
>
>Ta,
>
>Paul.
>
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
Paul G.
_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Home |
Main Index |
Thread Index
|