This is usually done with M41 and above. But it is REALLY machine specific (manual, automatic, number of ranges, etc..) so we don't provide any scripts for it. For example, a Haas only has low high gears on the spindle, thus, they only use M41 and M42.
You will have to create M41-46 macro scripts on your system that does the right thing.
Called in G code like this:
M41 (select spindle range #1)
S1200
M03
If the spindle ranges are set manually, you will want the machine to prompt you to change ranges. Also, a bit of code to check if it is already in the correct range might be nice to keep unnecessary prompting from happening.
Steve