Macro merge duplicate materials

Description
Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one. Only the first one will be kept, and all the objects that link to the duplicates will be linking to the first one instead. So before using this macro, make sure your first material (either the one without numerical ending or the lowest number found) is the right one.

Script
Merge duplicate materials.FCMacro