Jump to content

Alfred open specific folder in app


Recommended Posts

When you want to add a Workflow where a specific folder opens in the app Sublime Text Editor 2, how can one specify which folder to open?

 

This is done the same way that you specify a file to open with Sublime Text at the command line, using the open command. 

open -a /Applications/Sublime\ Text\ 2.app/ <file or folder to open>

If you are looking to select an item in Alfred to open, you could use the previous command and replace the <file/folder> with "{query}" to open the selected file. You could also use the Open File action and set Sublime Text as the application to use to open the selected file. I have a workflow that when a file is selected in Alfred, I press the right arrow to get my list of actions, and I have an Open With Sublime action. It saves the step of "Open With.." and then specifying Sublime as the target app

Link to comment

Thnx for your reply. Oké I kinda get what you are saying. Your suggestion on opening a folder with different programs is very nice, but not quite wat I am looking for.

 

The scenario is, I add a keyword "development" and then Alfred shows me the projects I have added there. For instance one is a local development on my system named "wordpressmu". This triggers automatically a few programs, and then I want it to open the folder with Sublime Text in which my program is located.

 

I'm new to Alfred, so could you be more specific in how to add it to the "Workflows" tab? You say "..at the command line" do you mean I have to Add (+ icon) the Action "Terminal command", and add for instance this line:  

"open -a /Applications/Sublime\ Text\ 2.app/ <//Volumes/WERKSCHIJF/DEVELOPMENT/local/wordpress.ms/wp-content/themes>"
Edited by Broeiend
Link to comment

Solved it. Added a terminal command:

#browse to wp-theme-bone folder
cd ~Volumes/WERKSCHIJF/DEVELOPMENT/local/wordpress.ms/wp-content/themes/wp-theme-bone

#open folder in sublime text (notice the .)
/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl .
Link to comment

 

Solved it. Added a terminal command:

#browse to wp-theme-bone folder
cd ~Volumes/WERKSCHIJF/DEVELOPMENT/local/wordpress.ms/wp-content/themes/wp-theme-bone

#open folder in sublime text (notice the .)
/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl .

 

The code you had before would work, you just needed to remove the <> around the path. I placed that in the original example to denote that being a placeholder.

open -a /Applications/Sublime\ Text\ 2.app/ "/Volumes/WERKSCHIJF/DEVELOPMENT/local/wordpress.ms/wp-content/themes"

That should work.

Link to comment

The code you had before would work, you just needed to remove the <> around the path. I placed that in the original example to denote that being a placeholder.

open -a /Applications/Sublime\ Text\ 2.app/ "/Volumes/WERKSCHIJF/DEVELOPMENT/local/wordpress.ms/wp-content/themes"

That should work.

 

 

Oké, this works thank you. And how can I get to run terminal in silent mode?

 

Got it, I saw your post on another page. I added a "Run script" instead of a "Terminal Command" so now the terminal isn't opened anymore. Thank you David :)

Edited by Broeiend
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...