Last active
September 29, 2023 16:26
-
-
Save dblandin/4659973 to your computer and use it in GitHub Desktop.
AppleScript to grab a list of tab titles from Google Chrome.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Activate tab | |
# $ osascript activate_tab.applescript 1, 2 | |
on run argv | |
set window_index to item 1 in argv | |
set target_index to item 2 in argv | |
tell application "Google Chrome" to set active tab index of first window to target_index | |
tell application "Google Chrome" to activate | |
end run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List tab titles in Google Chrome windows | |
set titleString to " | |
" | |
tell application "Google Chrome" | |
set window_list to every window # get the windows | |
repeat with the_window in window_list # for every window | |
set tab_list to every tab in the_window # get the tabs | |
repeat with the_tab in tab_list # for every tab | |
set the_title to the title of the_tab # grab the title | |
set titleString to titleString & the_title & return # concatenate | |
end repeat | |
end repeat | |
end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Result: | |
" | |
Hacker News | |
Product Hunt | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment