Loading
scriptkit-showcase 9 exercises
lesson

Save Chrome Tabs in a Markdown File and Take Notes

We put a lot of work into browsing the internet every day, it would be a pity to lose it all by closing all of our tabs.

Script Kit can collect all of the tabs you currently have open in Chrome using its getTabs method and store them anywhere you want.

This particular script converts the tabs to m

Loading lesson

Transcript

0:00 Often before closing a whole bunch of tabs, you want to save them because you're doing research. I'll write a script called Save Tabs. Hit Enter. Script Kit has a utility called getTabs which returns an array of tabs that have title and URL on them.

0:17 Let's take those tabs and map them. We'll grab each tab and map it to a string, which is just a bullet with the markdown URL syntax. This can be the tab title. This can be the tab.URL. Sometimes the title won't exist, so we'll say this might be to tab URL.

0:35 Then we'll join these back together, just with the new line here, and we'll call these tabs markdown. Our tabs array should be a bulleted list in markdown. To take some notes on that, we'll pass that markdown into our editor. We'll say tabs MD. If I run Save Tabs, you'll see our editor pops open with markdown of all of the tabs that I've opened in Chrome.

1:02 I could come in and take notes anywhere inside of here. We'll close this. In order to save this, we'll call this Notes. We'll need a file. We'll call this File Path and just create a file in our home directory. We'll call it Tab Notes.MD. First, we'll ensure that the file exists, so file path.

1:22 Then we'll append the file each time we save, so file path and pass in our notes. Then just to verify that this is working, we'll pass the file path into edit, so it opens in our editor. I'll fire open save tabs. I'll scroll down to the bottom and take some notes.

1:42 I'll hit Save here with Command S. You'll see that opens in our editor with all of those tabs and links, and my notes are at the bottom. You could put your notes anywhere in here and that would work. Let's do that again. I'll hit Save Tabs and I'll come down here.

1:58 Let's say, "This is a great site." Scroll to the bottom and say, "This is the bottom." Hit Save again. You'll see there's our notes there. We'll scroll to the bottom and there's the rest of our notes.