Scripting not only allows you to run custom actions when Focus turns on and off, but allows you to control Focus from other applications.
This is a very powerful way to extend Focus for your needs---allowing you, for example, to turn Focus on after 5 minutes have passed.
Let's learn how to accomplish this with Focus scripting.
Applescript is a system wide way to script applications on Mac OS X, and is perfectly suited for this task.
Applications > Utilities > Script Editor and type the following:
delay 300 do shell script "open focus://focus?minutes=30"
Pay special attention to the delay 300 and minutes=30.
These lines say wait for 300 seconds (5 minutes) and then turn Focus on for 30 minutes. You can change these to suit your needs.
If you hit Command+R or press the play button in Script Editor, it will execute your script by waiting for the amount of time specified---then starting Focus for the other duration specified.
This is great, but you don't really want to go through Script Editor every time you want to run the script.
Luckily there's an easy way to get these in your menubar so you can access them a lot faster.
Script Editor > Preferences > General > Script Menu and make sure "Show script menu in menubar" is checked.
Now you'll have a new icon in your menubar. When you click it, it will list the available scripts to run on your computer.
Click the menubar icon and go to
Open Scripts Folder > Open User Scripts Folder.
This will reveal the directory where user scripts need to go to show up in the menubar.
Go back to Script Editor and save the file (or move it if you used the download) to the directory above.
Now when you click the Script Editor menubar icon, you'll see the script listed.
To start the script, just click the menu item. You should see another item appear in your menubar letting you know the script is running successfully, and after 5 minutes (or whatever you specified) Focus will start.
That's it! Focus scripting is extremely powerful and can accomplish a lot. If you have something specific you'd like to do, email us at [email protected] and we'd love to see how we can help!