How do you open a new window in safari and then open multiple tabs with different urls in that window using apple script?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The way to create a new window in Safari is to use the
make new documentcommand:This will create a new window with a single tab pointing to
the_urland make that window frontmost. Note thatmake new window at end of windowsdoesn’t work, and just errors out with “AppleEvent handler fails”.Similarly, to create a new tab within a window
w, you can usemake new tab:This will create a new tab in window
wat the end of the list of tabs; this tab will be pointing tothe_url, and it won’t be the current tab. Instead of explicitly sayingtabs of w, you can also use atell wblock:That way,
tabsimplicitly refers totabs of w.Putting this all together, we get the following script. Given a list of URLs in
the_urls, it will open all of them in a new window; ifthe_urlsis empty, it opens a window with a blank tab.