alfresco script
===

I am struggling to write a script in alfresco to rename file extension

The file is saved as filename.bin. I am using content rules to say when filename equals *bin rename to *pdf

I am struggling a bit with the script and would appreciate any help

    My script is as follows
    // change the name of this document
    document.properties.name = document.properties.name+".pdf";
    // add a new property string
    document.properties["cm:locale"] = mylocalenode;
    // save the property modifications
    document.save();

but doesnt seem to get me anywhere. Pls help