A script ran by "Run After Reset" feature should find an empty configuration (no ip address, no system identity, etc.).
I have myself an initialization script that will run only if it considers the box has default settings. I test for no ip address (other than eventually 192.168.88.1/24), and default system identity :
# A box is considered unconfigured if system identity name is the default "MikroTik" and
# it has no ip address or only the default 192.168.88.1/24 .
if ( ( [/system identity get name] = "MikroTik" ) and \
( [:len [/ip address find where address!="192.168.88.1/24"] ] = 0 ) \
) do={
:log warning "This box is brand new. Configuring it !"
# ADD ANY CODE YOU WISH
}
hope this helps.