Sending backup after any change of configuration

Hi,

I´d like to ask you about help.
I try to write a script which send an e-mail with backup after any change of configuration.

Code:

:global h ($h + 1 - 1);
:if ([:len [/sys history find by=“arroyo”]] > $h) do {/system backup save name=([/system identity get name] . “-” . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]);
/tool e-mail send to=“arroyo@seznam.cz” subject=([/system identity get name] . " Backup " . [/system clock get date]) file=([/system identity get name] . “-” . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . “.backup”); :delay 10; /file rem [/file find name=([/system identity get name] . “-” . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . “.backup”)];
:log info ("System Backup emailed at " . [/sys cl get time] . " " . [/sys cl get date]); :global h [:len [/sys history find by=“arroyo”]]} else {:log info ("System Backup not necessary at " . [/sys cl get time] . " " . [/sys cl get date])}

It doesn´t work with 4.x RouterOS.

Could anyone of you help me?

Thanks.

How to detect (in script) taht /system history has changed? Not increased numer of /system history changes, because the maximum value is 100, but dedect any change at /system history and after that - run any action (for instance send e-mail).