Technically you can resolve any macro as long as you have enough info in your macro context. Macro essentially is a replacement. For example you need to update description for a given tree node and description contains macro:
TreeNode node = ... // init your node for what you want to update the description
string descriptionWithMacro = " {%CurrentDocument.DocumentName@%} has description... bla bla "
MacroResolver resolver = MacroResolver.GetInstance();
resolver.SetNamedSourceData("CurrentDocument", node); // Set CurrentDocument to node
string desc = resolver.ResolveMacros(descriptionWithMacro);
node.SetValue("MyDescriptionField", desc); // update
If you don't have enough context you need provide it i.e. For {% Settings.MyCustomSettingsAPIKey |(identity)GlobalAdministrator%}
"Setting" must be known for MacroResolver. If it is not known you can do resolver.SetNamedSourceData("Settings", YourSettingOjectWithCustomSettingsScriptProperty)
P.S. There is a GlobalMacroResolver, which is probably aware of the "settings" object so you might just do MacroContext.GlobalResolver.ResolveMacros().