Just looked at the first example I gave, likely it would not work as it would likely progress through the macro and set the spindle speed higher each time.
You would need to do it like the second example, ie only have one line that actually sets the commanded speed, that line being the
SetSpinSpeed(rpm)
Hood