Working on several coding projects, I've seen a typical theme in how I get started. The pattern usually consists of opening all the relevant files (Repos, Trello Board, text editor, server, etc.). If I'm working on a project after a long break, takes a good minute or two remembering which files are important and getting everything setup.
Even otherwise it gets cumbersome opening all these files each time. Small loss of time and an unnecessary mental overhead which should rather be served on coding. Being the lazy developer that I am, wanted a simple hotkey I could use (typically named after the project), and like a container have everything automagically setup.
AppleScript seemed like a good candidate. I also use OneTab meticulously to launch commonly used tabs. But I knew there could be an even faster way of doing this. Since I've already purchased the pro-version of Alfred made more sense to develop my own workflow using its GUI. Alfred has strong claims with optimization, and I've enjoyed using awesome workflows developed by the community.
Having not written any workflows before, these were the steps I took:
Alternate Options for Opening Multiple tabs:
I ended up using the process described above. But here are a few other ways of opening multiple tabs in the browser of your choice.
1- OneTab:
Actions -> Open URL -> Paste in Shared OneTab url which holds a collection of the relevant project tabs.2- Run AppleScript:
on alfred_script(q)
set urlList to {"http://www.macintouch.com/", "http://www.macnn.com/", "http:// www.macworld.com/", "http://www.thinksecret.com/", "http://www.tuaw.com/"}
set numURLs to (count urlList)
tell application "Google Chrome"
activate
-- create all the tabs that are needed
tell application "System Events"
-- enter the url in the open window
keystroke (item 1 of urlList)
key code 36
repeat with i from 2 to (numURLs)
-- for each additional url, first create a tab
tell process "Google Chrome"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
-- now enter the url
keystroke (item i of urlList)
key code 36
end repeat
end tell
end tell
end alfred_script
Credit: https://alvinalexander.com/blog/post/mac-os-x/applescript-open-multiple-urls-in-safari-tabs
3- Bash Script:
open -a "Google Chrome"
open http://apple.com
open http://google.com
open http://yahoo.com
open http://bing.com
open http://bbc.co.uk
open http://wikipedia.org
open http://imdb.com
Future Enhancement
This new workflow is definitely a delight to use, and spares several minutes of my life every time I sit down to get productive. For a second iteration I would like to ability to open the workstation in a separate desktop (Mac Spaces).