That would be almost impossible to work because of the timing involved.
You can do it, but because of ping, lag etc. it would hardly ever work & you would have to constantly adjust the script with wait commands. You could perfect it while playing by yourself & then find it won't work at all online.
This is one of those things where it is easier to do it manually I think.
The key to the 5 swing combo from side to side in yellow or blue is to immediately change directions as soon as the swing starts, don't wait until it is halfway through or longer or it sometimes won't work.
If there's a script out there that works for this I haven't seen it yet.