I’m a Paladin. My specs are Protection and Retribution. I want to write a macro that basically says:
if Protection mark target with skull else /assist
Then I can replace my assist key with it to quickly be able to mark targets while tanking, but assist the tank when DPSing.
You can indeed do several things depending on your spec. To achieve your example goal, try the below. This uses a combination of macro conditionals and Lua scripting.
/script if (GetActiveTalentGroup()==1) then SetRaidTarget("target", 8); end; /assist [spec:2]
What this says is, if I’m in spec 1, then set raid target 8 (skull). Then, assist my target, if I am in spec 2.
See Macro Conditionals for full documentation on the conditional statements you can use.