|
The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024
|
|
[Date Prev][Date
Next][Thread Prev][Thread Next][Date
Index][Thread Index]
Re: Programming E2k
Amar,
Here's my morning wakeup script which accesses my Outlook calendar and
reads
out my appointments for the day ahead.
Hope this is helpful.
Paul G.
PS, if you want to write the sort routine that I haven't got round to yet,
then please feel free!... ;-)
>From: "Amar Nagi" <amar@xxxxxxx>
>Reply-To: ukha_d@xxxxxxx
>To: <ukha_d@xxxxxxx>
>Subject: [ukha_d] Programming E2k
>Date: Thu, 18 Jul 2002 16:17:10 +0100
>
>Has anyone got any sample code in vb/vbscript of extracting information
>from exchange server 2000 ?
>
>I want to extract my calendar details and announce them using
homeseer,
>
>
>+
>
>
>Yahoo! Groups Sponsor
>ADVERTISEMENT
>
><http://rd.yahoo.com/M=228862.2128520.3581629.1829184/D=egroupweb/S=1705041992:HM/A=1155069/R=0/*http://adfarm.mediaplex.com/ad/ck/990-1736-1039-302>
>
>For more information: http://www.automatedhome.co.uk
>Post message: ukha_d@xxxxxxx
>Subscribe: ukha_d-subscribe@xxxxxxx
>Unsubscribe: ukha_d-unsubscribe@xxxxxxx
>List owner: ukha_d-owner@xxxxxxx
>
>Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
><http://docs.yahoo.com/info/terms/>
.
><< winmail.dat >>
_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Yahoo! Groups
Sponsor |
ADVERTISEMENT
|
|
For more information: http://www.automatedhome.co.uk
Post message: ukha_d@xxxxxxx
Subscribe: ukha_d-subscribe@xxxxxxx
Unsubscribe: ukha_d-unsubscribe@xxxxxxx
List owner: ukha_d-owner@xxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
'*********************************************************************************************************************
'* 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
Home |
Main Index |
Thread Index
|
|