MacOS – How to reproduce Windows Chrome BAT files setup in macOS 10.15

applescriptgoogle-chromemacos

On Windows, Chrome is my primary browser.
I've developed a series of *.bat files on Windows that each open a series of tabs with specific URLs in Chrome:

@echo off
set BROWSER=chrome.exe
set WAIT_TIME=2
cd %USERPROFILE%\Desktop\bat
start %BROWSER% -new-window "https://calendar.google.com/calendar/r/month"
@ping 127.0.00.1 -n %WAIT_TIME% -w 1000 > nul
start %BROWSER% -new-tab "https://contacts.google.com/"
start %BROWSER% -new-tab "https://voice.google.com/"
start %BROWSER% -new-tab "https://hangouts.google.com"
start %BROWSER% -new-tab "https://drive.google.com"
start %BROWSER% -new-tab "https://maps.google.com"
start %BROWSER% -new-tab "https://www.youtube.com"
start %BROWSER% -new-tab "https://news.google.com"
start %BROWSER% -new-tab "https://photos.google.com"
start %BROWSER% -new-tab "https://one.google.com"
start %BROWSER% -new-tab "https://classroom.google.com"

How would I reproduce this functionality in macOS 10.15 using AppleScript?

Best Answer

As a shell script or directly in Terminal it can be done with

#!/bin/sh

open -a "Google Chrome" --args \
    https://calendar.google.com/calendar/r/month \
    https://contacts.google.com/ \
    https://voice.google.com/ \
    https://hangouts.google.com \
    https://drive.google.com \
    https://maps.google.com \
    https://www.youtube.com \
    https://news.google.com \
    https://photos.google.com \
    https://one.google.com \
    https://classroom.google.com

In AppleScript you can use

tell application "Google Chrome"
    open location "https://calendar.google.com/calendar/r/month"
    open location "https://contacts.google.com/"
    open location "https://voice.google.com/"
    open location "https://hangouts.google.com"
    open location "https://drive.google.com"
    open location "https://maps.google.com"
    open location "https://www.youtube.com"
    open location "https://news.google.com"
    open location "https://photos.google.com"
    open location "https://one.google.com"
    open location "https://classroom.google.com"
end tell