Attached scripts will not execute

There is a special syntax for triggered scripts. Look at the Synchronize script in the Extras>Examples folder of the installation package for a good model. Or browse the forum for other triggered scripts that have been posted.

for example