Hey Czar just a heads up. I was using this script to enchant ruby amulets and I happened to run out of cosmic runes, but I still had ruby amulets. The script kept on clicking the spell on the amulets despite being out of cosmic runes. The strange thing is that the logger did indeed mention running out of cosmics and mentioned stopping the script, yet it kept on going.
edit: probably gg account after one million tries to enchant this amulet. Lol fuarkkk