Try the castsequence suggestion offered. To use the same button repeatedly like that you need to use castsequence.
Code:
/castsequence reset=combat/24 Shadow Word: Pain, Devouring Plague, Vampiric Touch, Mind Blast, Mind Flay, Shadow Word: Pain, Mind Flay, Mind Blast, Mind Flay, Vampiric Touch, Mind Blast
This for example is one of my shadow priests old rotation macros. Each press of the button will execute the next spell in the list and will reset the list when combat ends or 24 seconds has passed. Whether you can use modifiers in a sequence I don't know as I don't use them.