Jump to content

Open selection with specified application


Recommended Posts

I'd like to make a workflow that will open the file you currently have highlighted in Finder with an app you specify to Alfred.

 

I'm pretty sure that getting the selected finder item will require applescript, but I'm not entirely sure. I have little coding experience, so I'm basically piecing together different scripts I can find online. So far, I have this:
 

tell application "System Events"
	set app_id to (get the id of application "q" as string)
end tell
tell application "Finder"
	set sel to selection
	if sel is not {} then
		set filepath to item 1 of sel as text
		open filepath using application file id "app_id"
	end if
end tell

The problems are a) that doesn't work and B) it depends on you giving Alfred the exact name of the app, rather than just a few letters as in a typical Alfred search. For example I want to be able to select a jpeg in finder, call up Alfred and type "o ps" and have the list of apps show up with the top one being Photoshop, and then press enter and have the file open in Photoshop.

 

Any help is greatly appreciated.

PD

Link to comment

I'd like to make a workflow that will open the file you currently have highlighted in Finder with an app you specify to Alfred.

 

I'm pretty sure that getting the selected finder item will require applescript, but I'm not entirely sure. I have little coding experience, so I'm basically piecing together different scripts I can find online. So far, I have this:

 

tell application "System Events"
	set app_id to (get the id of application "q" as string)
end tell
tell application "Finder"
	set sel to selection
	if sel is not {} then
		set filepath to item 1 of sel as text
		open filepath using application file id "app_id"
	end if
end tell

The problems are a) that doesn't work and B) it depends on you giving Alfred the exact name of the app, rather than just a few letters as in a typical Alfred search. For example I want to be able to select a jpeg in finder, call up Alfred and type "o ps" and have the list of apps show up with the top one being Photoshop, and then press enter and have the file open in Photoshop.

 

Any help is greatly appreciated.

PD

 

Have you tried the File Selection hotkey? This will do EXACTLY what you are looking for. Select one or more files in Finder, press Cmd+Opt+\ to get actions for the selected files. Choose Open With and search for the desired app.

Link to comment

Wow, I had no idea that even existed! I was wondering why there weren't any workflows that already existed to do this, now I have my answer. This works pretty well, but is there a way to directly trigger the action and not have to select it from the list? Even if I've set it to not show any of the other options, that's still an extra keystroke to select "open with" option. If not, I guess I can find time in my schedule for that extra enter press...  ;) I may keep pursuing the roundabout way for fun.

 

Thanks for the help!

Link to comment

Wow, I had no idea that even existed! I was wondering why there weren't any workflows that already existed to do this, now I have my answer. This works pretty well, but is there a way to directly trigger the action and not have to select it from the list? Even if I've set it to not show any of the other options, that's still an extra keystroke to select "open with" option. If not, I guess I can find time in my schedule for that extra enter press...  ;) I may keep pursuing the roundabout way for fun.

 

Thanks for the help!

 

Well, there are ways to do this but they are a little indirect. Unless you have the option ticked to sort actions by last used per file type then Open With should always be at the top. Alfred keeps them in a preset order so you should just be able to Cmd+Opt+\, enter, and type the name of the app.

Link to comment

I came across this post and would like to do the same thing, but always have the file I've selected in Pathfinder sent to Photoshop. My default for images is ViewIt and I don't want to change that. If, however, an image needs some retouching or work, I'd like to automatically send it to Photoshop with a keystroke combination.

 

I understand the Cmd+Opt+\ function, but that requires me to choose Photoshop as the application each time. Is there a way that I can use Open With and always have the image go to Photoshop?

 

Unfortunately, I'm not a programmer and I'm not sure how to pull this off in Alfred.

 

In advance, thanks to anyone who can help me with this.

Link to comment

I came across this post and would like to do the same thing, but always have the file I've selected in Pathfinder sent to Photoshop. My default for images is ViewIt and I don't want to change that. If, however, an image needs some retouching or work, I'd like to automatically send it to Photoshop with a keystroke combination.

 

I understand the Cmd+Opt+\ function, but that requires me to choose Photoshop as the application each time. Is there a way that I can use Open With and always have the image go to Photoshop?

 

Unfortunately, I'm not a programmer and I'm not sure how to pull this off in Alfred.

 

In advance, thanks to anyone who can help me with this.

 

If I 'get' what you are asking: this is simple enough:

 

1: Create a new workflow in Alfred by clicking on the "+" at the bottom of the workflows pane.

2: Select "Blank Workflow"

3: At the top right click on the "+" and select "Actions / Open file"

4: Double click on the "Open File" box just created and drag Photoshop into the RIGHT drop area 'the default application', then save.

5: At the top right click on the "+" and select "Triggers / Hotkey"

6: Double click on the "Hotkey" box just created and set your desired hotkey, and under 'Argument' select 'Selection in OS X' then save.

7: Then connect the Hotkey Box to the Open File box.

 

Now, any file you have selected in Finder will be sent to Photoshop by hitting your hotkey combo.

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...