How to start a Focus session after a certain amount of time.

How to start Focus in X minutes

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.

Creating an Applescript that turns Focus on in 5 minutes

Applescript is a system wide way to script applications on Mac OS X, and is perfectly suited for this task.

Open Applications > Utilities > Script Editor and type the following:

delay 300
do shell script "open focus://focus?minutes=30"

Script Editor Interface with Focus code

That's it!

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.

Making it more convenient to use

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.

Go to Script Editor > Preferences > General > Script Menu and make sure "Show script menu in menubar" is checked.

Script Editor Preferences Panel

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.

Script Editor Menu Dropdown

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!



Was this blog post helpful? Yes / No

« Back to Focus Productivity Blog
Posted on October 11, 2015



Focus

Drowning in distractions? They're chipping away at your productivity and focus. Fight back with Focus, the macOS app designed to block distractions and keep you on track. Regain your focus, achieve your goals, and find balance. Give Focus a try and see the difference it makes!

Download Focus
Try Focus free for 7-days!