Skip to content

Instantly share code, notes, and snippets.

@mreidsma
Last active August 20, 2018 12:26
Show Gist options
  • Save mreidsma/5689164 to your computer and use it in GitHub Desktop.
Save mreidsma/5689164 to your computer and use it in GitHub Desktop.
Automator Workflow for Writing Environment

Automator Workflow for Writing Environment

The internet is a distracting place, and when you work there, it makes getting things done difficult. Especially things like writing a book (or two). So I made an automator script to help me out. Here's how it works:

  • It quits every application but iTunes, Writedown (my Markdown editor of choice), and Tictoc (my time tracking tool).
  • It shuts off Wifi so the Internet goes away.
  • It sets the computer's volume to an appropriate level.
  • It plays an iTunes playlist of ambientish music that is perfect background for writing.
  • It makes Writedown go full screen so I don't get distracted by other things.

Download the app

It uses a bit of Applescript, a shell script, and a lot of canned Automator actions. You can download the binary at https://dl.dropboxusercontent.com/u/1540081/Write.zip

Setup

You'll need to customize a few things, unless you have stolen my computer.

  • Change the playlist you want iTunes to play.
  • Change the apps that get opened and can stay open to your text editor and music player of choice. Might need to adjust the Applescript as well.
  • Turn on support for assistive devices in System Preferences > Accessibility if you want the Applescript to be able to set Full Screen mode for Writedown (or whatever editor you choose)
  • You may also need to adjust the internet device that gets turned off, depending on your setup. On my machine, en0 is Ethernet, and en1 is Wifi. You can see your devices by running networksetup -listallhardwareports in the Terminal.

License

Do whatever the hell you want with this. In my version, I'm using a snazzy typewriter icon by Gary Gehiere at http://www.pixelpressicons.com/?cat=3, but you'll need to find your own sweet icon.

UPDATE 2/15/2016

I've changed the way I do this, now, since switching back to Sublime Text. I do almost everything right through automator, using the shell script to kill the internet but otherwise using Automator functions. Here is the full breakdown for what I do now:

Automator workslow for Writing environment

-- Applescript to start task timer and bring editor to the front and make full screen
-- Change the key combinations on line 13 if you are using a different editor
tell application "Tictoc"
start task "Writing"
end tell
activate application "Writedown"
delay 3
tell application "System Events"
set frontmost of process "Writedown" to true
tell process "Writedown"
keystroke "f" using {control down, command down}
end tell
end tell
# Shell script to turn off wifi
networksetup -setairportpower en1 off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment