Effective Applescript: Opening a Google Chrome Bookmark Folder
I've been attempting to live my life 30 minutes at a time recently and part of that is ensuring that I'm not constantly distracted by my inbox. Unfettered access to attention is the devil's own work and as little as possible should be allowed.
As such I've been trying to make it a practice recently of shutting down every app and site that acts as an inbox for me unless I'm actively engaged with it. My practice then is to essentially check my inbox every 30 minutes or so in case something truly urgent has come in and practice Inbox Zero each time, moving anything that takes more than 2 minutes but is not truly urgent into my todo list.
Doing this every 30 minutes was starting to become annoying despite how effortless it is to open apps and sites using Quicksilver so I decide to take it a step further and automate it with Applescript so I can simply whack ⌘-space inbox RET and get to down to business.
tell application "Google Chrome" repeat with b in (get URL of bookmark items of bookmark folder "Inbox" of bookmark folder "Bookmarks Bar") open location b end repeat end tell tell application "Mail" to activate tell application "Slack" to activate
The primary reason I'm posting about this generally uninteresting script is because at first I actually had all the bookmarks in my "Inbox" folder explicitly listed out in separate open location … statements. This was obviously less than ideal because I decided to add Twitter to my Inbox and would've then had to go and add it to the script by hand.
I did a little bit of digging and found out that the Chrome dictionary does, in fact, support accessing bookmarks by folder. Then a quick trip to Stack Overflow got me over the hump.
As an aside I originally had the statement repeat with b in (URL of bookmark items… rather than repeat with b in (get URL of bookmark items… but was erroring out with an error code that didn't yield anything obvious (but what Applescript error codes ever do?). It's unclear to me why the get is necessary here. get is one of those things that I still sometimes just start sprinkling over my Applescripts until they seem to work which is never a good place to be.
Happy scripting!













