OK, so lets try it a different way.
Put this code into the M3.m1s macro in the profile you are using, remove the current dospin() code :-
You can also put this in the M4.m1s too
SetUserLED (1220, 1)
ActivateSignal(Output3) 'turn on chiller
ActivateSignal(Output2) 'turn on spindle
Then put this into the M5.m1s macro as above :-
DeActivateSignal(Output2) 'turn off spindle
DeActivateSignal(Output3) 'turn off chiller
SetUserLED (1220, 0)
Then put this into a sub program in the subs folder of your profile, call it "warmup.tap" :-
(warmup.tap)
S18000
G4 P1200
S27000
G4 P1200
S36000
G4 P1200
M99
Your calling code would look like this :-
M3 (turn on chiller and spindle)
M98 (warmup.tap) (call spindle warm up sub)
M4 (turn off chiller and spindle)
M30
Graham