Macro with a modifier key AND changes spell based on spec or spell known?

My current shadowmeld macro:

#showtooltip
/cast [nomod] Shadowmeld
/cast [mod:alt] Life-Binder’s Invocation(Azerite Essence)

However, I want it to switch so if I have a different azerite essence equipped (which happens in Feral) then the alt automatically instead will cast Concentrated Flame(Azerite Essence).

Is this possible to do? To tie it to either spec or essence known?

;

That replace 2nd /cast

/cast [mod]spell;[mod:alt]spell2

Realy can only do this with spells that both can do or it will lock up.
The ui already makes bars for each spec.
The main keys are shaired accrost account/toon so you can macro as per spec that way. Put the macros on the only spec bar …

/cast [spec:1,mod,talent:2/3]SPELL; [spec:2,mod] Spell; [talent:1/1] SPELL

Yours specifically I would write like this

/cast [mod] Heart Essence; Shadowmeld

1 Like

“Heart Essence” is the generic name for the on use ability

/cast [mod,@player] [@mouseover,exists,nodead][] Heart Essence

That is my essence macro

#showtooltip
/cast [mod:alt] Heart Essence; Shadowmeld