A couple of days ago David Sparks wrote about how to put your Mac to sleep with iOS Drafts. His post reminded me of the fact that I haven’t yet given any credit to Keyboard Maestro Control for iPhone. It’s a little helper which enables you to trigger your macros from your iPhone.
If you’re a Keyboard Maestro user and haven’t checked out this free add-on to the world of Keyboard Maestro here are some examples for you:
Locking, Unlocking and sending your display to sleep
Although it hasn’t been updated recently I use an utility application called Lock Screen 2 which mimics the iPhones slide to unlock mechanism and brings it to the desktop.
You can use it with the keyboard or a Magic Trackpad. In addition you can assign a custom pattern, for instances in the screen shot below I used the combination of holding down
⌘⇧ and then sliding over the keys from A to G. When using the Magic Trackpad you can also specify which hotkey combination to hold down and with how many fingers you’d have to perform the slide gesture to unlock the screen.
Here are the macros for locking and unlocking the device. The hotkey on the left is the shortcut I assigned to lock my screen whilst on the right the foremost mentioned slide gesture get triggered to unlock the screen.
If you don’t want to purchase another application you can also lock your Mac with this shell command:
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
With this solution it isn’t possible to unlock the screen with Keyboard Maestro Control since all this piece of code does is triggering same behavior like the build-in Fast User Switching menu and you’ll end up on the login screen of your Mac.
Still, there are other free solutions, c.f. this app.
If all you want to do is sending your display to sleep you can use a hotkey action in Keyboard Maestro to use the system wide shortcut
⇧^⏏ or the build in Sleep Screen action:
Log Out, Sleep and Shut Down macros
Often times in the evening when I’m on the couch I wait for my Mac to finish a job. After the task in question has finished I want my Mac to shut down or go to sleep. If I know the ruff time frame I just fire up one of the macros on my iPhone.1
Starting and Quitting a Menubar Application
There are some applications that need to run on the Mac to use their iPhone counterparts. I don’t want them running all the time, so a macro to toggle them is a good solution for these kind of apps.
The solution is pretty simple. Go to one of the best ressources of the web for all things related to scripting (aka Justin Lancy’s’s site) and download the Toggle an Application On / Off AppleScript (which I mentioned before but since it’s one of my favorites I can’t praise it highly enough). The first and last step: add your application in the specified line and put the whole script in an Execute AppleScript action.
Start SuperDuper! Backup
I haven’t set up any scheduled SuperDuper backups since I don’t leave my Mac running (or sleeping) over night. But there are enough times over the week to run my backups. So, in the application I configured the Copy tasks I usually perform and saved them. Then I initiate them from my iPhone with a macro that looks like this:
- Read Gabe’s post where he explains the basic setup of Keyboard Maestro Control and gives some use-case examples: Remote Macro Execution.
- I’m a big fan of MyPhoneDesktop. The Mac app comes with a shortcut (
⌘CC) which sends your clipboard to the connected iDevice. I use it to send me a screen shot of an application to my iPhone. It’s not as simple as calling up iTeleport, but if it’s what you want Keyboard Maestro can make it happen.
- If you don’t want to spend money on Panic’s Prompt and have a Mac which is always on Keyboard Maestro Control is a great and cheap alternative if you just want to call up some scripts.
- Force empty your Trash. The macro could look something like
sudo rm -R ~/.Trash/*+ RETURN + USER PASSWORD + RETURN (I don’t recommend it since you’d have to put your user password in Keyboard Maestro)2.
- Set up some Volume controllers on your iPhone – a mute macro could come in handy.
- Switching from your speakerbox to headphones.
- Force quit stubborn applications.
- Flick through the System Control actions in Keyboard Maestro and see if there’s something useful in it for you, c.f. setting the network location or switch user accounts.
Last words: I really like Keyboard Maestro Control and hope Peter will find the time some time in the future to give the app an update – just iPhone 5 support alone would be nice enough for me.