[HELP][Macro]Advanced macro help for HoA Essence window and Change spec

In Legion, I had made some nice macros that would select my 3 different specs with a left click, as well as open the window to select and view my Artifact weapon UI with a right click. An example macro was this one:

#showtooltip 16
/run if SecureCmdOptionParse("[btn:2]") then SocketInventoryItem(16) else SetSpecialization(3) end

I would like the same functionality, but with the Heart of Azeroth Essence window opening instead.

I found this macro here, but I have no idea how to get it to do the change spec with the left click button, and do that with the right click.

/run function ae() LoadAddOn("Blizzard_AzeriteEssenceUI")local aef=AzeriteEssenceUI if aef:IsVisible()then aef:Hide()else aef:Show()end end ae()

Thanks for any help!