Page 1 of 1

Communicating with Outlook

Posted: Sun Sep 01, 2013 10:32 pm
by wee wullie
Has anyone used the outlook calender code on Ken Rays Sons of Thunder website http://www.sonsothunder.com/devres/live ... iac002.htm, it seems to be the only site with info on this subject,
i have tried using it in a stack but it doesn't work, i tried saving the uVBScript code in the custom properties of the stack itself and then in the custom props of the button, i'm probably missing something very obvious here, if anyone can help - please.

Re: Communicating with Outlook

Posted: Mon Sep 02, 2013 10:55 pm
by Simon
Hi wullie,
That post needs some updating:
This should go into the stacks custom property uVBScript

Code: Select all

Const olAppointmentItem = 1

Set objOutlook = CreateObject("Outlook.Application")
Set objAppointment = objOutlook.CreateItem(olAppointmentItem)

objAppointment.Start = #<<START_DATE_TIME>>#
objAppointment.Duration = <<END_DATE_TIME>>
objAppointment.Subject = "<<SUBJECT>>"
objAppointment.Body = "<<BODY>>"
objAppointment.ReminderMinutesBeforeStart = <<REMIND_MINS>>
objAppointment.ReminderSet = True
 
objAppointment.Save
And in the button:

Code: Select all

on mouseUp
  put "9/3/13 9:00AM" into tStart
  put "60" into tEnd
  put "Doctor's Appointment" into tSubject
  put "Call 555-5555 beforehand to confirm." into tBody
  put 30 into tRemindMins
  SetAppointment tStart,tEnd,tSubject,tBody,tRemindMins
end mouseUp

on SetAppointment pStart,pEnd,pSubject,pBody,pRemindMins
  put the uVBScript of this stack into tScript
  replace "<<START_DATE_TIME>>" with pStart in tScript
  replace "<<END_DATE_TIME>>" with pEnd in tScript
  replace "<<SUBJECT>>" with pSubject in tScript
  replace "<<BODY>>" with pBody in tScript
  replace "<<REMIND_MINS>>" with pRemindMins in tScript
  runScript tScript
end SetAppointment 

on runScript pVBS
  set the hideConsoleWindows to true
  put specialFolderPath("desktop") & "\temp.vbs" into tTempPath
  put pVBS into url ("file:" & tTempPath)
  get shell("cscript.exe //nologo" && tTempPath)
  send "delete file" && quote & tTempPath & quote to me in 1 second
  -- this gives enough time for the script to run before you delete it
end runScript
Aside from the custom script I did do a few changes to the button script
tEnd is now in minutes from tStart
and I am using the desktop to put the vbscript.

Simon
Edit: This is working with Outlook 2010 Windows (naturally)

Re: Communicating with Outlook

Posted: Mon Sep 02, 2013 11:59 pm
by wee wullie
Outstanding Simon, it works superbly , thank you so much for your help :D

kindest regards
Wullie

Re: Communicating with Outlook

Posted: Tue Sep 03, 2013 12:19 am
by Simon
Glad it works for you!
Using C:\temp.vbs wasn't working for me, you probably want to change desktop to documents.

Simon