Jump to content
Phasedetect

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

Share this post


Link to post

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.

Share this post


Link to post

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!

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

Thanks so-o much. This worked perfectly and is exactly what I wanted. Clearly you "got" what I was trying to do, and taught me some tricks about Alfred at the same time.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...