Good script so far, a couple things I noticed though.
It would be more efficient to drink the stamina potions at 80% run energy. Also I have noticed it will withdraw 2-3 stamina potions which wastes a few inventory slots. I have no coalbag and am using ice gloves. Perhaps it is filling those unused slots with stamina potions? It would be slightly mroe efficient to have that extra 2 bars per run. Furthermore, with my setup it would be quicker to hit the deposit all button and withdraw 1 stamina and 27 ore every time.
If it is at all possible to put more coal in while waiting for the bars to come out, that could help too. It likes to wait next to the bar dispenser after putting in the primary ores.