Dynamic icons depending on talent

Is there a way I can use a macro to change the icon of said macro depending on what talent I’m using?
For instance I swap between Balance Affinity and Restoration Affinity on my druid and I use the same keybinds for the abilities. One macro that I have for instance is

#showtooltip
/cast Ursol’s Vortex
/cast Typhoon

And because Ursol’s Vortex is the first in the list, the #showtooltip refers to that and I see it when I’m in Restoration affinity. But when I change to Balance affinity, the ability is replaced with Typhoon, and I then only see a red question mark, I’d like to see the icon for Typhoon as well as the cooldown/
Is this possible?
Thank you for your time.

Update:
I found a sort of solution.
It doesn’t work as clean as I want, but it works nonetheless. This was found in Useful Macro Templates

the macro looks like

#showtooltip
/cast Ursol’s Vortex
/cast Typhoon
/run local G=GetSpellInfo SetMacroSpell(GetRunningMacro(), G"Ursol’s Vortex" or G"Typhoon")

so when I change specs I get a big red “?” but after I cast the ability, it shows up.

You’re already using the best solution that I’m aware of. There might be an addon that does the same thing but tests spells known more frequently but it’s the same thing in essence.

For arbitrary spells as Elvenbane says that solution is about the best you’ll get within a macro. (You need something to listen to events when you swap specs; which means a frame which means easier in an addon.)

But in this case it seems like a standard use of [talent] would be what OP wants but maybe I’m missing something:

#showtooltip
/cast [talent:3/1] Typhoon; Ursol's Vortex
1 Like

lol yeah, do that. I went looking to see if Nature's Control worked in this case and missed the obvious answer entirely when it didn’t.

I read op’s to ask for this?

I undetstand I miss quoted your post, but on phone

It may not work as it stands.
Awhile ago I wanted a toons buff shown and I used something like it.

Not quite, I’m looking for icons to show when I switch affinities as Guardian. The two I go through are Balance and Restoration.
The keybinds are use are for Wrath/Rejuvenation, Swiftmend/Sunfire, Moonkin Form/Wild Growth, and Ursol’s Vortext/Typhoon.
I was looking for a macro to change the icons on those keybinds when I change the talent from one to the other, rather than showing the icon of the specific affinity, rather than the ability gained from it.

[talent:3/1] on a feral or guardian druid is Balance Affinity.

The keybinds are use are for Wrath/Rejuvenation, Swiftmend/Sunfire, Moonkin Form/Wild Growth, and Ursol’s Vortext/Typhoon.

#showtooltip
/cast [talent:3/1] Wrath; Rejuvenation

#showtooltip
/cast [talent:3/1] Starfire; Swiftmend

#showtooltip
/cast [talent:3/1] Moonkin Form; Wild Growth

#showtooltip
/cast [talent:3/1] Typhoon; Ursol's Vortex

Thanks for your reply, I’ll give it a shot when reset madness is over!

You can combine spec:# and talent:r/c conditions however you want to dynamically change stuff depending on spec + talent choice. Can toss form:# into the mix for Druids too.

This works so well! The only one I can’t see working is the first one as Wrath is available regardless of the talent choice. But that’s so minor I’m not worried about it.
I’m really relieved that when I swap affinities, the icons swap over so I can see more easily