Using setMaxFileAssetMetadata but NOT sticking

Hi all,

If I run the below code on a test file to search for a particular string in an array inside the metadata and collect the rest to a new array and then use setMaxFileAssetMetadata on the maxfile with the NewmetaArray it doesn't stick.

It'll not have any effect on the metadata.
Any thoughts on this would be great. Cheers all.

See code for more info.
Link to AD help on setMaxFileAssetMetadata: https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_2AF2AF...

-- Maxfile to get metadata
theMaxFile = @"C:\\Users\\username\\Documents\\3dsMax\\scenes\\Maxstart - Copy.max"
 
-- Get the metadata
oldMetaArray = getMAXFileAssetMetadata theMaxFile
 
-- Format print the old metadata
for i in oldMetaArray do (format "\nOLD METADATA: %" i)
 
-- Search for an array where there's not string matching "type:#animation resolvedFilename" and collect
NewmetaArray = for i in oldMetaArray where not matchpattern (i as string) pattern:"*type:#animation resolvedFilename*" collect i
 
-- Set theMaxFile with the NewmetaArray
setMaxFileAssetMetadata theMaxFile NewmetaArray
 
-- Check the theMaxFile metadata. Opps! Still the same.
for i in oldMetaArray do (format "\nNEW METADATA, STILL THE SAME: %" i)