Ewon TechForum
Providing technical solutions to technical requests


ONDATE and ONSTATUS issues.
Boris D. Offline
Junior Member
#1
Hi,

I'm trying to send a mail with an attached CSV file each week. When I try manually, the mail is sending correctly.


Code:
ONCHANGE "Sendthemail", "GOTO Sendmail_LABEL"

But when I use ONDATE, nothing happens. I've tried some synthax and command, though.


Code:
ONDATE 1,"0 22 * * 5","GOTO Sendmail_LABEL"



So, maybe I've missed  something and I need to change something in the Task Planner?

I don't want to use the Task Planner to send the mail, because I use dynamic name and I want to delete the file after it is sent.

About the ONSTATUS, I don't understand how to use it. When I go to "Sendmail_LABEL", I've tried to delete the file after the mailing. But if I use "ERASE" after the "SENDMAIL", the file is deleted before the sending, so I get an empty file. I know I need to use the "ONSTATUS" function to know when the mail is sending, but with the syntaxe and the example writing in the programming reference guide, I don't know how to link the ONSTATUS to the SENDMAIL.


Code:
ONSTATUS "goto Erase_LABEL"

Erase_LABEL:
ERASE "/usr/Test.csv"
END
 
Any help will be appreciated.

Boris.
Reply

simon Offline
eWON Support
#2
Boris,

You have to use the ActionID parameter to detect in the ONSTATUS that it has well been fired by the call of the sendmail function.

See example :


Code:
ONSTATUS "GOTO ScheduledActionEnd"
SENDMAIL "test@test.com","","subject","msg"
a% = GETSYS Prg,"ACTIONID" : REM Save ActionId of Sendmail
END

ScheduledActionEnd:
REM Get ActionID that fired the ONSTATUS and compare with the one saved
   b% = GETSYS Prg,"EVTINFO"
    IF a% = b% THEN
        SETSYS Prg, "ACTIONID", b%
                REM Read Status of the Action
        c% = GETSYS Prg,"ACTIONSTAT"
                REM if = 0 --> Success
        IF c% = 0 THEN
            ERASE "/usr/file.txt"
        ENDIF
    ENDIF
END
Reply

Boris D. Offline
Junior Member
#3
Simon,

You saved me again ! It works fine, and I've find why ONDATE wasn't working.

Thank you for all,

Boris
Reply



Possibly Related Threads…
12-06-2019, 10:21 AM
Last Post: OBS_SA
  ONDATE scheduling Started by dblake
1 Replies - 1.429 Views
11-07-2018, 04:44 PM
Last Post: ziozetti



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy