Getting my mac to automatically open specific apps and websites after I log in

the internet

The “problem”

Unsure if this qualifies as OCD, laziness, or medically-dangerous impatience; but I have a very low tolerance for wasting time on things that can somewhat-easily be automated or done faster. Especially if the tasks are repetitive.

For example, after I log into my laptop, having to use my hands to type into Spotlight Search and/or to move the mouse to control my laptop’s cursor for navigating, selecting and clicking all the things necessary in order to launch the three same applications that I use on a daily basis, gets to me. Negatively.

So, last night I did something about it. And now, I’m sharing a (work-in-progress) solution in case it helps someone else out there. Or to see if anyone knows a better way to achieve the same result.

Background: I code every day, without exceptions. That means no exceptions.

So once per day, I turn my personal laptop on to at the very least use (i) iTerm, (ii) Visual Studio Code, and (iii) Brave Browser. Does it make sense to waste clicks and gestures in getting these three apps open every ~24 hours?

The “solution”

In deciding how to ask my laptop for help, I decided to write an AppleScript script. Here’s why:

(0) “Opening” items at log in would not launch those windows; it just starts them.

(1) The use-case doesn’t require any low-level logic, and AppleScript is expected to seamlessly interact with applications.

(2) Found some threads where folks reported issues with Automator in Big Sur (which my 2019 MacBook Pro Version 11.6 is running)

(3) A .scpt script can be exported as an app via Script Editor and ran automatically after a user logs in.

Requirements:

  • After I log in, open iTerm, Brave and Visual Studio Code.
  • In Brave, launch tabs to log onto Github, StackOverflow, Twitter & LinkedIn.
  • If I were to execute the script from the terminal after login, and any of these apps is already running, let me know.
https://github.com/aa-ag/applexperiments

A few key, interesting learnings:

  • Running the script as soon as the user is logged in proved counterproductive: the system needs a second to connect to your network.
  • Each open location will open a new tab, so the last url (from the top down) should be the “first”/front-most website you want to see. And the same goes for each app.
  • Will work on additional features; feel free to keep an eye on the repo.

Demo

Using my phone to record my laptop starting up was a lot awkward, and resulted in terrible-quality footage — please bare with me:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store