Automatically Open Multiple Websites, Part 2: your own AppleScript

Updated December 18th, 2015.

Last time, we saw how we could open multiple websites with a single click. Problem is, the websites that we opened with one click were the ones I chose. So, now we’re going to learn how to specify which websites get opened.

We’re going to write an AppleScript, and we’re going to use Script Editor to do it. You can find Script Editor in your Utilities folder, which is in your Applications folder. Bonus shortcut hint: click on the Finder in the Dock (or the Desktop, or some other Finder window so as to bring the Finder to the front). Click on the Go menu and slide down to “Utilities.” Presto.

Find the Script Editor in the Utilities folder and double-click it. You’ll get a blank window. Copy the text below and paste it into the blank Script Editor window.

set the_URL_list to {“http://www.apple.com”, “http://www.christianboyce.com”, “http://macrumors.com”}

repeat with a_URL in the_URL_list
open location a_URL
end repeat

The result will look a lot like this:

Click the Compile button and it will look like this.

(Compiling checks for mistakes and prettifies the script. Your script could look different than this but don’t worry about that– unless you get an error. In that case, go back and be sure you copied and pasted the right stuff.)

Just for fun, click the “Run” button. You’ll see three web page load: www.apple.com, www.christianboyce.com, and www.macrumors.com.

Assuming that the script works and that you got three web pages when you clicked “Run,” it’s time to customize it to open YOUR websites. You can probably tell that the place to do it is right at the top. Go in there and do it! Just remember these rules:

  1. Each website must be surrounded by double-quotes.
  2. Separate the double-quoted websites with commas.
  3. No returns please. Let the Script Editor wrap the text for you.

There is no limit to the number of sites you can enter. Try a couple, and then click Compile, and if you don’t get an error, click Run. Add the rest of the websites that you want to open, and Compile, and then Run. If it works, you’re ready to save it. Here you have to be just a little careful, because there are various ways to save your script, and only one of them is the right one for our purposes.

What we want is to wrap this script up in a double-clickable application that does its thing automatically. So, when you go to Save As…, change the File Format to Application. Name your script anything you’d like, and put it somewhere that you can find it. For now, let’s put it on the Desktop. Now you can quit the Script Editor, because we’re done with it.

Look for the script you just saved. Here’s what it will look like:

(Yours might have a different name. That’s OK. But the icon should be like this one.

Technically, you’re done. When you double-click the script it will launch your preferred browser and load up your web pages. That’s two clicks, and that’s not much work. But, we can cut that work in half by putting the script into the Dock. So do that. Remember that putting something into the Dock doesn’t mean you can throw away the original. Put the original– your script– somewhere safe and that’s that.


Copyright 2008-2024 Christian Boyce. All rights reserved.

Did this article help you?

Maybe you'd like to contribute to the
Christian Boyce coffee fund.




Want some some quick iPhone how-tos?
Visit me at iPhoneinaminute.com.

Looking for quick tips about Macs?
See my One-Minute Macman website!



Please use the “Sharing” buttons to share what’s interesting with your friends. It helps your friends and it helps me too. Thank you very much!

Sincerely,
Christian signature
Christian Boyce

Christian Boyce is a Mac and iPhone expert with over 30 years' experience in the field. His specialty is teaching people how to get more out of their Macs and iPhones using the software and apps already installed. He is the author of several books, a guest speaker for Mac and iPhone user groups worldwide, and a former rocket scientist. He splits time between homes in Santa Monica, California and Round Rock, Texas.

Please Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

Read our Privacy Policy