Web Developer from Omaha, NE
While in Safari on my Mac I come across someone that I think would be a good follow on Twitter, usually after reading their website/blog. I try to avoid Twitter.com whenever possible. I much prefer firing up Tweetbot and looking at a person’s past tweets, photos/videos, who they follow and who follows them etc. Typically, I would have to open up Tweetbot go to the search tab, copy the username from Safari, paste it into the search field, select the user and hit follow. I do this quite a lot while on following binges and it gets really old to be constantly copying and pasting and switching back and forth between apps.
Text Expander workflow
I resigned to just create a TextExpander snippet that contained the URL structure needed to view a profile in Tweetbot. The snippet that I call with “tbotp” is:
When that URL is entered into Safari it automatically switches the application to Tweetbot and goes to the specified user account. I would copy the [profile_screenname] – Twitter username – portion of the Twitter.com url from Safari, select the entire URL, enter my tbotp text expander snippet and hit enter. It worked just fine and because I have my Text Expander snippets synced through Dropbox I could also perform this workflow on my iOS device.
I wanted to:
- Extract the Twitter screenname from the current URL in Safari.
- Insert that screenname into the appropriate Tweetbot URL scheme.
- Execute the URL so that Tweetbot would show me the profile page of that user.
- Use that code to create a Safari bookmarklet so I could use a keyboard shortcut to execute it on my Mac and also have it synced, though iCloud, across to my iPhone and iPad.
It turned out to be much easier that I thought it would be. I’m not 100% sure this is an ideal way of doing it but it certainly works for me and that’s all I really care about.
I relied on Google for almost every part of this.
- I looked at how to grab the current URL in Safari and found
- I chose the split to occur after at .com/ so the script would grab everything after the .com/ which is typically the Twitter screenname.
- I created a blank bookmarklet in Safari called tweetbot.
Even with something so simple as this bookmark I can’t tell you how satisfied it made me feel to figure it out. It was a good day.
If you would like to use this bookmarklet feel free to drag the button below into your Safari Bookmarks Bar and then edit the bookmark replacing my Twitter username with your own.