Features, discussions, tips, tricks, questions, problems and feedback

Sending emails question

this is a section of the script i have to send alarm messages to the operators in the roster .
there are 5 rosters and each roster has 8 possible recipients .( MobileNo 1to 8 )
in the for / next loop . The script works as it should if there is only 1 recipient , but when there are 2 or more recipients ( in any of the 8 spots in the roster ) it only sends the message to the last recipient .
I have tried it with and without the adroit.waitforchange lines , but it makes no difference .
I have also tried different adroit.wait times and still no difference.
anybody got any clues ?

Hi Ted,

Looking at your script excerpt…


Email-Send-Now is the slot of EmailAlarms notify agent…Email-Send-Now.value is a typo.

So it should read :

emailsent = Adroit.waitforchange(“EmailAlarms.Email-Send-Now”)

Also you dont need the loop in the above call if you are inspecting a boolean type, waitforchange is already blocking.

The loop mechanism as described in our help system is there as an example say if the change under inspection is gradual - like waiting for emptying of a tank level using an analogue.

A useful tip : when struggling with scripts - use message boxes to follow the operation of your code

MsgBox “rosternum=” & RosterNum

And don’t forget you can comment out lines by prefixing a single quotation mark " ’ ".

The waitforchange call in the above code never ends if one attempts a wait on an invalid tag, and hence why you only see one email.
Adding the line “On Error Resume Next” still does not remedy this situation.