Last active
October 19, 2021 16:36
-
-
Save larrywright/c32abbeb97725e0b6722c763b5065bd4 to your computer and use it in GitHub Desktop.
A MacOS Automation for converting a Safari window full of tabs into Markdown-formatted links, as well as one for just a single link.
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
on run {input, parameters} | |
if not running of application "Safari" then return | |
tell application "Safari" to set title to name of current tab of front window | |
delay 0.1 | |
tell application "Safari" to set link to URL of current tab of front window | |
delay 0.1 | |
set the clipboard to "[" & title & "]" & "(" & link & ")" | |
delay 0.1 | |
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
on run {input, parameters} | |
set tabsInfo to {} | |
set markdown to "" | |
tell application "Safari" | |
set tabsList to front window's tabs as list --gets all open tabs | |
repeat with currTab in tabsList | |
set currName to currTab's name | |
set currURL to currTab's URL | |
set currNum to currTab's index | |
set markdown to markdown & " | |
" & "- [" & currName & "]" & "(" & currURL & ")" | |
copy {tabName:currName, tabURL:currURL, tabNumber:currNum} to end of tabsInfo | |
end repeat | |
end tell | |
return markdown | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment