I have a few options for our machines that I do not want the spindle turning on while being used.
I wrote a custom m3 that if those tools are the current tool to not turn on the spindle.
I used registers to pass the information to the m3.
Here is the code.
function m3()
   --wx.wxMessageBox('In M03') 
   --mc.mcCntlSetLastError(inst, "In M03")
   local inst = mc.mcGetInstance()
   --Get Spindle On and Spindle Auto handles
   local hSpin = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON)
   local hreg = mc.mcRegGetHandle(inst, 'iRegs0/SpindleAuto')
   --Get spindle on state
   local SpinOn = mc.mcSignalGetState(hSpin)
   --Get Spindle Auto value
   local SpinVal = mc.mcRegGetValue(hreg)
   --get if tk turned on and tk osc selected
   local TKOnOff = mc.mcCntlGetParameter(502)
   local TKOReg = mc.mcRegGetHandle(inst, 'iRegs0/TKOscOnOff')
   local TKORegVal = mc.mcRegGetValue(TKOReg)
   
   local TKOnOffReg = mc.mcRegGetHandle(inst, 'iRegs0/TKOnOff')
   local TKOnOffVal = mc.mcRegGetValue(TKOnOffReg)
   
   if (TKOnOff == 0) then--or (TKOnOffVal == 0) then
      if (SpinVal == 0) then
         --mc.mcSignalSetState(hSpin, 0)
      elseif (SpinOn == 0) then
      
         local hregSpinType = mc.mcRegGetHandle(inst, 'iRegs0/SpindleType')
         local SpinType = mc.mcRegGetValue(hregSpinType)
         --local hregSpinCool = mc.mcRegGetHandle(inst, 'iRegs0/SpinCool')
         local hsigSpinCool = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
         if (SpinType == 2) then --and (TKOnOff == 0)then
            --mc.mcRegSetValue(hregSpinCool, 1)
            mc.mcSignalSetState(hsigSpinCool, 1)
            wx.wxMilliSleep(2000)
         end
--         if (TKOnOff == 0) then
            mc.mcSignalSetState(hSpin, 1)
            --local hrSpinType = mc.mcRegGetHandle(inst, 'iRegs0/SpindleType')
            --local SpinType = mc.mcRegGetValue(hrSpinType)
            if (SpinType == 0) then
               wx.wxMilliSleep(1500)
            elseif (SpinType == 1) then
               wx.wxMilliSleep(5500)
            elseif (SpinType == 2) then
               wx.wxMilliSleep(11000)
            end
--         end
      end
   elseif (TKOnOff == 1) and (TKORegVal == 1)then
      local TKOscH = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT9) 
      mc.mcSignalSetState(TKOscH, 1)
   end
end
if (mc.mcInEditor() == 1) then
   m3()
end