A common question is people asking how to set various system preferences, like sound output devices or display settings. This article describes general ways of doing this.
There are several ways to go about a task like this where Keyboard Maestro does not provide direct support.
1. Control the UI directly using Keyboard Maestro. Use a sequence of actions which launch the system preference pane, click in various locations or type select various options. Often you will need to use Pause actions throughout the sequence to ensure the actions perform correctly.
2. Control the UI using AppleScript GUI scripting. Similar, but use AppleScript to control the UI.
3. Use AppleScript (or sometimes shell scripts) to make the change directly without using the UI. This is generally better if there is a method to do it this way. It will be faster and have less disruption for you when executing, but many actions cannot be controlled in this way.
The best way to figure out how to do these sorts of things is to search the net, adding the keyboard "AppleScript" to your query. So in this case, search for something like:
AppleScript set sound output source
Chances are someone has figured out how to do this using AppleScript and then it's just a matter of plugging it in to an Execute AppleScript action. If you can find a direct method (like method 3), use that, and otherwise you probably have an easy solution with method 2 (although this tends to break when the system changes). Failing this, and assuming you aren't an AppleScript expert, you can resort to method 1, perhaps using the Click at Found Image actions to help ensure robustness.
Posted Friday, September 13, 2013. Permalink. Post a Comment.
None yet.
Comments