Cocktail can be automated by using either Cocktail's build in Pilot or by using macOS's Automator application. Cocktail comes with pre-build Automator actions for you to use.