Skip to content

Instantly share code, notes, and snippets.

@piercemoore
Created October 14, 2017 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piercemoore/45b4b717512812a985318d9e0f93911e to your computer and use it in GitHub Desktop.
Save piercemoore/45b4b717512812a985318d9e0f93911e to your computer and use it in GitHub Desktop.
Automator script to get URLs of all tabs in a safari window
var Chrome = Application('Google Chrome');
var Safari = Application('Safari');
Safari.includeStandardAdditions = true;
Chrome.includeStandardAdditions = true;
var urls = [];
Safari.windows[0].tabs().forEach(function(tab) {
console.log(tab.url())
urls.push(tab.url())
})
urls
// console.log(safari.windows[0]);
//console.log(chrome.windows[0]);