Arms is my spec 1 (primary) and Prot is my spec 2 (secondary).
If I'm in primary spec (1), this macro runs the Arms profile and then runs stopmacro.
If I'm in secondary spec (2), this macro runs the Arms profile, sees I'm not in spec 1, so it continues to then run the Prot profile.
On retail, the spec modifier corresponds to 1,2,3, and 4. Most classes have 3 but it of course differs for Demon Hunters (1-2) and Druid (1-4). You'll need to slightly adjust the macro if you want it to work for 3 or more specs, of course.