It won't work. It's hard to explain, but the combat script functions imply a single action/cast. Here, there are actually two (selecting the type of arrow + selecting the spell). This means there isn't a suitable function. For the same reason, you can't cast teleport with a script (selecting the target + selecting the location). But you can try to emulate the arrow action – first, cast "Rain of Arrows," and then the desired spell on the units that will take damage after the volley.
Added 1 hour and 4 minutes ago
It won't work. It's hard to explain, but the combat script functions imply a single action/cast. Here, there are actually two (selecting the type of arrow + selecting the spell). This means there isn't a suitable function. For the same reason, you can't cast teleport with a script (selecting the target + selecting the location). But you can try to emulate the arrow action – first, cast "Rain of Arrows," and then the desired spell on the units that will take damage after the volley.