Using time in script editor

Questions, problems, and other issues for Ascendis Caller ID that aren't covered by the other forums.
Post Reply
JT

Using time in script editor

Post by JT »

Just purchased Ascendis.

I having a problem on trying to figure out how to set between times.

I'm wanting to do this.

If timenow >= "something" and timenow <= "something"
sendemail
endif

In another words, I wish to sendemail only between certain hours.

Thanks,
JT
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Using time in script editor

Post by Bill Root »

Hello JT,

Here is a script that sends an email only between the hours of 8 am and 5 pm:

Code: Select all

//LANGUAGE=DWS

if &#40;Time > StrToTime&#40;'8 am'&#41;&#41; and &#40;Time < StrToTime&#40;'5 pm'&#41;&#41; then
begin
  SendMail&#40;
    // from email address
    'myemail@myisp.com', 
    // recipient email address
    'mycellphone@mycellularprovider.com',
    // subject
    'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number,
    // message
    'Call received on line ' + CallInfo.Line&#41;;
end;
To use it, create a new category (if you haven't already) and change the Action Type to Advanced. Then paste the above code into the script. This is a complete script by itself, or you can add it to an existing script.

You will have to change the from and recipient email addresses appropriately. You can easily change the times by changing the '8 am' and '5 pm' accordingly.

If you created a new category for the action, don't forget to change the "Category for new callers" in the General page of the Options window to use the new category, if you want it to work for most callers.

If you need the action to do something else, let me know!

Finest regards,
Bill Root
Post Reply