Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grab all open tab titles and urls and convert them to markdown #17

Open
Jaymon opened this issue Apr 15, 2020 · 0 comments
Open

Grab all open tab titles and urls and convert them to markdown #17

Jaymon opened this issue Apr 15, 2020 · 0 comments

Comments

@Jaymon
Copy link
Owner

Jaymon commented Apr 15, 2020

It would be kind of cool to be able to run a command that would grab all open tabs and urls and convert them to:

[<TAB TITLE>](<TAB URL>)

I could modify this applescript: Getting a text file with the url of open tabs:

tell application "Safari"

    -- Count the number of Windows
    set numWindows to number of windows


    repeat with w from 1 to numWindows

        --Count the number of Tabs
        set numTabs to number of tabs in window w

        repeat with t from 1 to numTabs

            -- Set the Tab Name and URL values
            set tabName to name of tab t of window w
            set tabURL to URL of tab t of window w

            -- Create the Tab link and write the code
            set output to output & "    <a href=\"" & tabURL & "\">" & tabName & "</a>" & linefeed as string
        end repeat
    end repeat
end tell

-- Close out the HTML document
set output to output & "</body>
" & "</html>
"

-- Write the entire HTML document to TextEdit

tell application "TextEdit"
    activate
    make new document
    set the text of the front document to output
end tell

To work with Chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant