Skip to content

Instantly share code, notes, and snippets.

@osteele
Forked from samyk/chrome_tabs.osa
Last active July 10, 2019 19: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 osteele/704d40f90e17d7bc059d06731056bbe7 to your computer and use it in GitHub Desktop.
Save osteele/704d40f90e17d7bc059d06731056bbe7 to your computer and use it in GitHub Desktop.
applescript to show all url+titles of Chrome tabs along with front window+tab url+title
#!/usr/bin/env bash
# shows all url+titles of Chrome along with front window+tab url+title
# Source: https://gist.github.com/osteele/704d40f90e17d7bc059d06731056bbe7
# Forked from: https://gist.github.com/samyk/65c12468686707b388ec43710430a421
# Original author: https://gist.github.com/samyk
(osascript << EOF
set titleString to ""
tell application "Google Chrome"
set windowList to every window # get the windows
repeat with theWindow in windowList # for every window
set tabList to every tab in theWindow # get the tabs
repeat with theTab in tabList # for every tab
set tabUrl to the URL of theTab # grab the URL
set tabTitle to the title of theTab # grab the title
set titleString to titleString & "- [" & tabTitle & "](" & tabUrl & ")\n"
end repeat
set titleString to titleString & "\n---\n\n"
end repeat
end tell
EOF
) \
| grep -v '](chrome:' \
| sed 's/\(.*](\)chrome-extension:\/\/klbibkeccnjlkjkiokjodocebajanakg\/suspended.html#.*uri=\(.*\)/\1\2/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment