Assigning macros and saving .xrni

Is there any known way to assign macros via scripting?

and is it possible to save instruments as .xrni with scripting?

Thank you