I am using these scripts made by REXTENDED, I have copied and pasted the same as the original scripts and I cannot find why the file is not created
:global addLogToFile do={
:local filename "$1"
:local fileext ".txt"
:local maxlen 4095
/file
:if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filename "flash/$filename"}
:local wkfilename "$filename$fileext"
:if ([:len [find where name=$wkfilename]] = 0) do={print file="$wkfilename"; :delay 5s; set $wkfilename contents=""}
:local filecon [get $wkfilename contents]
:local filelen [:len $filecon]
:local addthis "$2\r\n"
:local addlen [:len $addthis]
:if (($filelen + $addlen) > $maxlen) do={
:set filecon ""
:set filelen 0
:delay 1s
}
:set filecon "$filecon$addthis"
set $wkfilename contents=$filecon
:delay 1s
}
/system
:local date [clock get date]
:set $date ([:pick "$date" 4 7]."".[:pick "$date" 0 4]."".[:pick "$date" 7 11])
:local time [clock get time]
:set $time ([:pick "$time" 0 2]."".[:pick "$time" 2 8])
/file
:local filename "TESTING"
:local filecontent [get $filename contents]
:local newfilecontent "*********************************************\r\nTIME: $time DATE: $date\r\n$filecontent"
[$addLogToFile $filename $newfilecontent]
set $filename contents=$newfilecontent
taking advantage of the help, how would I send the file by mail before it is deleted?
Thanks for the help.
EL DONCITO.
You altered my function.
If there were things written inside it was not by random.
I can’t find where I’m wrong REX, help me please,
EL DONCITO.
Try to stop to copy & paste random script here and there.
:global addLogToFile do={
:local filename "$1"
:local fileext ".txt" ; # can be only .txt !!!
:local maxlen 4095
/file
:if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filename "flash/$filename"}
:local wkfilename "$filename$fileext"
:if ([:len [find where name=$wkfilename]] = 0) do={print file="$wkfilename"; :delay 2s; set $wkfilename contents=""; :delay 1s}
:local filecon [get $wkfilename contents]
:local filelen [:len $filecon]
:local addthis "$2\r\n"
:local addlen [:len $addthis]
:if (($filelen + $addlen) > $maxlen) do={
:set filecon ""
:set filelen 0
:delay 2s
}
:set filecon "$filecon$addthis"
set $wkfilename contents=$filecon
:delay 1s
}
{
/system clock
:local date [get date]
:local time [get time]
:set $date "$[:pick $date 4 7]$[:pick $date 0 4]$[:pick $date 7 11]"
:local filename "TESTING" ; # do not put any extension, only the filename
:local logthis "*********************************************\r\nTIME: $time DATE: $date"
[$addLogToFile $filename $logthis]
}
Thanks REX, in the file write like this.

But I would like you to write like this, of course if you can.

EL DONCITO.
What is? The game “Find the differences between two images”?
How many are they?
Maybe a description…
simplye change
:set filecon "$filecon$addthis"
with
:set filecon "$addthis$filecon"
Excuse me friend REX, I did it as you recommended and it’s still the same.
EL DONCITO.
Is not possible, you done it wrong.
:global addLogToFile do={
:local filename "$1"
:local fileext ".txt" ; # can be only .txt !!!
:local maxlen 4095
/file
:if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filename "flash/$filename"}
:local wkfilename "$filename$fileext"
:if ([:len [find where name=$wkfilename]] = 0) do={print file="$wkfilename"; :delay 2s; set $wkfilename contents=""; :delay 1s}
:local filecon [get $wkfilename contents]
:local filelen [:len $filecon]
:local addthis "$2\r\n"
:local addlen [:len $addthis]
:if (($filelen + $addlen) > $maxlen) do={
:set filecon ""
:set filelen 0
:delay 2s
}
:set filecon "$addthis$filecon"
set $wkfilename contents=$filecon
:delay 1s
}
{
/system clock
:local date [get date]
:local time [get time]
:set $date "$[:pick $date 4 7]$[:pick $date 0 4]$[:pick $date 7 11]"
:local filename "TESTING" ; # do not put any extension, only the filename
:local logthis "*********************************************\r\nTIME: $time DATE: $date"
[$addLogToFile $filename $logthis]
}
Check yourself what you done wrong,
for me work:
TIME: 01:00:10 DATE: 02/jan/1970
TIME: 00:59:57 DATE: 02/jan/1970
TIME: 00:59:44 DATE: 02/jan/1970
The script is working very well friend Rex, how can I send the file before it reaches 4095 bits by mail
EL DONCITO.
I’m not going to edit the script one bit at a time again,
because every time you add a subsequent request instead of clearly explaining what you need.
Check how long it takes to fill up, and have it sent out on a regular basis before it fills up.