I am not sure if I am asking this question properly, but I am trying write a script to change some settings on Mac OS Sierra, similar to this script which sets the clock in the menubar to appear as analog:
killall Dock;
defauls write com.apple.menuextra.clock IsAnalog -bool true;
killall SystemUIServer;
Instead, I would like to select a different keyboard layout which I have created using Karabiner elements, which also appears in the menubar, and I can change it using the mouse.
My question is basically, how can I figure out what commands to put in my script to make changes like this? Is there a way to record commands that are run when making mouse actions, and then simply paste those commands into a script and alias it to some shortcut? Any help on how to become proficient writing scripts like this would be helpful.