Created
March 29, 2016 16:11
-
-
Save blech75/98e0601cfe04f1a95046 to your computer and use it in GitHub Desktop.
AppleScript to Show Safari Tab and Window Names
This file contains 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
tell application "Safari" | |
set windowCount to number of windows | |
set docText to "" | |
repeat with w from 1 to windowCount | |
set currentWin to window w | |
if (name of currentWin is "") or (name of currentWin is "Extensions") then | |
-- do nothing | |
else | |
set tabCount to number of tabs in currentWin | |
repeat with t from 1 to tabCount | |
set currentTab to tab t of currentWin | |
set tabName to name of currentTab | |
set tabURL to URL of currentTab | |
if currentTab is visible then | |
set tabInfo to "[" & w & " *] " | |
else | |
set tabInfo to "[" & w & "] " | |
end if | |
set docText to docText & tabInfo & tabName & linefeed as string | |
end repeat | |
end if | |
end repeat | |
end tell | |
tell application "TextEdit" | |
activate | |
make new document | |
set the text of the front document to docText | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment