Mac

Exploring AppleScript with Alfred Shortcuts

If you have read my blog before, you’ll know that I am a big fan of Alfred (here). I love the shortcuts and the ability to make things quicker. One of the things I find myself doing quite frequently is looking for domains and their traffic counts on Alexa, Compete, and Quantcast.

So I took my SysAdmin based love of making things quicker and learned enough Applescript to let Alfred make my life easier. I wrote a script that when a domain argument is passed to it in Alfred, it will open up a Quantcast tab, a Compete tab, and an Alexa tab for that domain in Google Chrome (Note: With the script below, it MUST be Google Chrome). To install, go to the Alfred preferences and create a new Applescript extension.

Fill out the text boxes as follows:
Title: domstat
Description: Get the domain statistics for
Keyword: domstat

Now put this in the script box:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
on alfred_script(q)
    set competeURL to "http://siteanalytics.compete.com/" & item 1 of q
    set quantURL to "http://www.quantcast.com/" & item 1 of q
    set alexaURL to "http://www.alexa.com/siteinfo/" & item 1 of q

    tell application "Google Chrome"
        set activeIndex to get active tab index of window 1
        tell window 1
            set competeTab to make new tab with properties {URL:competeURL}
            set quantTab to make new tab with properties {URL:quantURL}
            set alexaTax to make new tab with properties {URL:alexaURL}
        end tell
        set active tab index of window 1 to activeIndex
    end tell
end alfred_script

To execute, just fire up Alfred and type: “domstat eric.lubow.org” and it will fire up Google Chrome and open up the tabs.

Update:
You can even download the Alfred extension directly from here.

Skip the algorithm. New posts, straight to your inbox

Don’t Buy My Book, It’s Old

Straight to Your Inbox

Videos

Manager Training

Beyond the Belt

Writing Archives

contact