1

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?

nohillside
  • 100,768
Quasaur
  • 111

1 Answers1

2

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
nohillside
  • 100,768
  • 1
    In the original batch file all of the URLs open in a single Chrome windows. Were i to start another batch file with different URLs, they would all open in a SECOND Chrome window. Does both of your examples accomplish that? If not, how would I make sure each script file opens a new Chrome window? – Quasaur Jan 16 '20 at 19:02
  • 1
    @Quasaur Not directly, the idea mainly was to give you something to start with. The links in the comments point to other answers with parts of the puzzle you try to solve here. – nohillside Jan 16 '20 at 19:33