Sample Script (DWS - if)

Top  Contents  Index 

This sample uses the if keyword to perform different operations depending on the line of the incoming call, and depending on the time of day.

 

 

//////////////////////////////////////////////////////////////////////////

// DWS Scripting demo -- if

//

// 01/14/04 WTR - created

//////////////////////////////////////////////////////////////////////////

// LANGUAGE=DWS

 

 

//////////////////////////////////////////////////////////////////////////

// differentiate between lines

//////////////////////////////////////////////////////////////////////////

if CallInfo.Line = '800 555-1212' then

begin

  Speak('Call came in on line 1');

end

else

begin

  Speak('Call came in on line 2');

end;

 

 

//////////////////////////////////////////////////////////////////////////

// perform different actions based on time

//////////////////////////////////////////////////////////////////////////

if (Time > StrToTime('8 am')) and (Time < StrToTime('12 pm')) then

begin

  Speak('Good morning');

end

else if (Time > StrToTime('12 pm')) and (Time < StrToTime('5 pm')) then

begin

  Speak('Good afternoon');

end

else

begin

  Speak('Good evening');

end;