Hello, I’m not sure if this question exist already so if it does please redirect me to the correct page.
I’m trying to get monthly files created by a PLC through eWON and download them to my computer. So far I’ve managed to somehow use the basic IDE scripting to copy the file to eWON memory. My big chalange now is how to get these data from eWON to my PC. I’ve already used the url option before in other projects but the problem with data is you can only specify one file name. what if I have 4,5,6 or in my case 12 different file that need downloading each month (they differ each month as well so they don’t have same name). how can I achieved that?
or is there a simpler way that don’t use basic for scripting, that in it’s self is long because I’m having to create different name for each file each time I want to get it to my eWON?
if you want to see my scripting, here it is:
ONDATE 6,“5 0 1 * *”,“GOTO PS_FTP”
ONSTATUS “goto Status”
ONCHANGE “FTP_prep”,“goto PS_FTP”
putFtpId% = 0
getFtpId% = 0
Rem — eWON user (end)
End
Rem — eWON end section: Init Section
Rem — eWON start section: Get Month
Rem — eWON user (start)
FUNCTION get_month$($month_v%)
IF $month_v% = 1 Then
$get_month$ = “Jan”
ENDIF
IF $month_v% = 2 Then
$get_month$ = “Feb”
ENDIF
IF $month_v% = 3 Then
$get_month$ = “Mar”
ENDIF
IF $month_v% = 4 Then
$get_month$ = “Apr”
ENDIF
IF $month_v% = 5 Then
$get_month$ = “May”
ENDIF
IF $month_v% = 6 Then
$get_month$ = “Jun”
ENDIF
IF $month_v% = 7 Then
$get_month$ = “Jul”
ENDIF
IF $month_v% = 8 Then
$get_month$ = “Aug”
ENDIF
IF $month_v% = 9 Then
$get_month$ = “Sep”
ENDIF
IF $month_v% = 10 Then
$get_month$ = “Oct”
ENDIF
IF $month_v% = 11 Then
$get_month$ = “Nov”
ENDIF
IF $month_v% = 12 Then
$get_month$ = “Dec”
ENDIF
Return
ENDFN
Rem — eWON user (end)
End
Rem — eWON end section: Get Month
Rem — eWON start section: PS FTP
Rem — eWON user (start)
PS_FTP:
IF FTP_Prep@ THEN
Site$ = “NMB”
Print “start”
T$ = Time$
year$ = T$(7 To 10)
year_int% = Val(year$)
month_val% = MONTH T$
//month_val% = month_val% - 1
month_val% = month_val%
//IF month_val% < 1 Then
// month_val% = 12
// year_int% = year_int% - 1
// year$ = SFMT year_int%,30,0,"%1d"
//ENDIF
FileName$ = “Basic” + year$ + @get_month$(month_val%) + “.csv”
HMI_File$ = “/StorageCard/DATA/” + FileName$
ewon_store_fn$ = “/usr/” + FileName$
ewonDir$ = “[$dtUF $uf/” + FileName$ + “]”
ftpDir$ = Site$ + “/PS/” + FileName$
Print "HMI File: “;
Print HMI_File$
GETFTP HMI_File$,ewon_store_fn$,":@10.0.33.15”
getFtpId% = GETSYS PRG,“ACTIONID”
ENDIF
Rem — eWON user (end)
End
Rem — eWON end section: PS FTP
Rem — eWON start section: Status
Rem — eWON user (start)
status:
eventId% = GETSYS PRG,“ACTIONID”
IF eventId% = getFtpId% THEN
stat% = GETSYS PRG, “ACTIONSTAT”
If stat% = 0 Then
Print “put ftp”
FTP_Ready@=1
//PUTFTP ftpDir$, ewonDir$
//putFtpId% = GETSYS PRG,“ACTIONID”
ENDIF
ENDIF
IF eventId% = putFtpId% THEN
stat% = GETSYS PRG, “ACTIONSTAT”
If stat% = 0 Then
Print “erase”
ERASE ewon_store_fn$
ENDIF
ENDIF
Rem — eWON user (end)
End
Rem — eWON end section: Status
your help will be much appreciated.
Thank you.