This is a quick tutorial showing how to implement an Alfred command to open your local Dropbox folder. In fact with a few small changes it can be adapted to open any folder.

Using the Alfred Command

Once implemented you will able to use a keyword to open you local Dropbox directly from Alfred. I use the keyword "dx".

Dropbox

Once you confirm the keyword in Alfred, a Finder window is opened showing the root of your local Dropbox folder.

Alfred Workflows

This keyword command is created using an Alfred Workflow. To be able to create and use Alfred Workflows you need to buy the Alfred Powerpack. You can upgrade from the free version of Alfred at https://www.alfredapp.com/powerpack/buy/

Alfred Preferences

Open the Alfred Preferences window (1). Your screen will differ from mine depending on which Worklflows you have installed.

What we’re going to do here is create a completely new Alfred Workflow. To do that click the plus button below the Workflow list on the left (2).

Create a New Alfred Workflow

Click the "Blank Workflow" option in the menu that appears from the plus button (1).

The New Alfred Workflow Dialog

This displays the new Alfred Workflow dialog.

The Basic Workflow Information

Complete the dialog, as follows:

  1. Name: Dropbox
  2. Description: Open Local Dropbox Folder
  3. Category: Tools
  4. Bundle Id: Leave blank
  5. Created By: Your Name
  6. Website: Your Website
  7. Icon: Drag and drop an image to represent your workflow within Alfred
  8. Finally click Save

Add a Keyword Trigger to the New Workflow

Right click in the Editor, the blank brown area, to the right of the Workflow list (1).

Click Inputs (2).

Click Keyword (3).

The Keyword Dialog

This displays the Keyword dialog.

Complete the Keyword Options

Complete the Keyword options as follows:

  1. Keyword: dx
  2. with space: Remove the tick
  3. Select "No Argument" from the Argument Required drop down (note that this will change the appearance of the dialog)
  4. Title: Open Dropbox Folder
  5. Subtext: Open the local Dropbox folder

The Completed Keyword Options

Once you have completed the previous step your Keyword Options dialog should look as follows.

Click Save (1).

Adding the Action

You should now have the Keyword block showing in the editor on the right (1).

Right click in the editor and select Actions (2) > Run NSAppleScript (3) from the menu.

Adding the Script to the NSAppleScript Dialog

The NSAppleScript dialog is displayed and shows 3 lines of code (1).

Replace the middle line of code with the following code, replacing YOURHOMEFOLDER with the name of your home folder:

tell application "Finder"
	set myWindow to make Finder window to folder "Macintosh HD:Users:YOURHOMEFOLDER:Dropbox"
	set current view of myWindow to list view
	set the sort column of the list view options of myWindow to the name column
	activate
end tell

The Completed NSAppleScript Dialog

Once you have added the code to the dialog click Save (1).

Linking the Keyword Block to the NSAppleScript Block (1)

Drag the Run NSAppleScript to the right in the editor to make room for the connection.

Linking the Keyword Block to the NSAppleScript Block (2)

Click and drag on the node of the Keyword block (1) dragging it to the right towards the Run NSAppleScript block.

Linking the Keyword Block to the NSAppleScript Block (3)

Once your mouse pointer is over the Run NSAppleScript block release the mouse pointer and the two blocks will be connected.

You’re Done

That’s it you’re done!

To test your new Workflow activate Alfred and type either "dx" or the keyword you chose back in the process and your Dropbox local folder will open in a window.

Bonus!

If you would only ever use this to view a specific folder within your Drobox folder you can amend the code to make this specific folder the one that opens when you use the Keyword.

To do this amend the code to include the specific folder. In this example I have added the Scrivener data folder to the end of the file path.

tell application "Finder"
	set myWindow to make Finder window to folder "Macintosh HD:Users:YOURHOMEFOLDER:Dropbox:Apps:Scrivener"
	set current view of myWindow to list view
	set the sort column of the list view options of myWindow to the name column
	activate
end tell