TabIt – Open Tabs in Chrome with a Variable

I constantly find myself needing to open a lot of similar tabs to research something at work. For example, maybe I want to review account notes on a few dozen accounts, or I want to audit 30-40 support tickets.

Most web apps usually just pass unique identifiers in the URL itself. For example, if you use Zendesk, a ticket URL might be https://subdomain.zendesk.com/tickets/123456 where 123456 is the Ticket ID number. You might have an internal CRM tool that has a URL like https://internal.company.com/accounts/95438.browsertabs

It doesn’t take a genius to figure out that by just changing the 95438 in the URL to a different number, you pull up a different account. So instead of going through the trouble of searching in the web app, most people just change the URL to the account they are looking for, or create a custom search in their browser.

When I have more than 4 or 5 of the same type of item I want to review (Tickets, Accounts, whatever), it becomes tedious to copy each item, open a new tab manually, paste the variable, and wait for the page to load.

For cases like this, I wrote a simple bash utility that I call tabit. Tabit has one job: Read input from a file and open a bunch of tabs with the specific variables. Here is a quick example using Youtube (since I obviously won’t share the links to Rackspace’s internal tools).

Say you have a list of the 10 most popular Youtube Video IDs.

We know that Youtube’s URL format is https://www.youtube.com/watch?v=<Unique ID>. Instead of manually copying/pasting that 10 times, here is how you would do it with Tabit.

First, grab the source from github: https://github.com/joshprewitt/tabit or copy the script below.

Place it somewhere in your default path. If you don’t know what that means, just put it at /usr/local/bin/tabit

Make it executable:

By default, Tabit looks for a file in your user’s home directory called ‘.tabit’. Paste the list of Youtube IDs into that file. If you are on a Mac and just copied the list above, the following will do the trick:

All that is left to do now is run the script. Using the defaults, the syntax is really simple: Just run

I added a few options like the ability to specify a file instead of the default ~/.tabit and also the option to have the tabs open in your current Chrome window. Lastly, if you happen to have a URL where the variable is NOT the last part of the URL, you can add on a suffix. You get the following help documentation if you run tabit with no arguments:

Help documentation for tabit

Basic usage: tabit [options] <start of URL with trailing slash> [Remainder of URL with leading slash]

Options:
-f <path to file>. — File to read variables from. Default is ~/.tabit
-c — Use Current Window.

That’s it! After you get used to using this, you will find that it is much easier to just paste the variables into ~/.tabit and run the script instead of manually opening a bunch of tabs.

Keyboard Shortcuts

When working with dozens (to hundreds) of tabs, don’t forget these shortcuts

Shortcut Keys Action
Cmd+Shift+{ Go to Left Tab
Cmd+Shift+} Go to Right Tab
Cmd+w Close Tab
Cmd+Shift+T Re-Open Most Recently Closed Tab
Click a tab + Shift + Click a different tab Select Range of Tabs (Cmd+w will close all selected tabs)

Gotchas

The script assumes a standard installation of Google Chrome. If you installed it somewhere else, you will need to edit lines 58 and 62 with the correct path to Chrome on your system.

References

Optargs help came from http://tuxtweaks.com/2014/05/bash-getopts/

Picture: Browsers by Eightemdi from the Noun Project

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">