Automation only works when GUI is open

Please erase this post I️ figures it out.