Jump to content

Look in specific folder and reveal results in spotlight


Recommended Posts

I would like to create a workflow that is close to the 'Filter from keyword and reveal', with a limited search scope but instead of display the search results in the Alfred window, I'd like it to reveal all search results in Finder (like spotlight, but restricted to a specific folder).

 

Any advice is much appreciated.

bests

John

Edited by johnjoonso
Link to comment

I would like to create a workflow that is close to the 'Filter from keyword and reveal', with a limited search scope but instead of display the search results in the Alfred window, I'd like it to reveal all search results in Finder (like spotlight, but restricted to a specific folder).

 

Any advice is much appreciated.

bests

John

 

So this would be a file filter with a limited scope, and you want to reveal them all in Finder? Would using the default Ctrl+Return hotkey on the result work? I guess I'm just trying to figure out exactly what you're wanting..

Link to comment

As he says, when he hits ALT+ENTER to show the results "in Spotlight", he wants the search scope to be limited to the same scope as the File Filter, not "This Mac", which is what Alfred does.

 

For example:

 

I have a File Filter set up to search ~/Dropbox. If I hit ALT+ENTER on any result to search with Spotlight, the scope is no longer ~/Dropbox, but the entire system.

Link to comment

So this would be a file filter with a limited scope, and you want to reveal them all in Finder? Would using the default Ctrl+Return hotkey on the result work? I guess I'm just trying to figure out exactly what you're wanting..

First part yes, second part: when I press Ctrl+Return on my File Filter with a limited scope (keyword is 'fonts'), it brings up a Web Search with 'fonts foobar'.

 

 

As he says, when he hits ALT+ENTER to show the results "in Spotlight", he wants the search scope to be limited to the same scope as the File Filter, not "This Mac", which is what Alfred does.

 

For example:

 

I have a File Filter set up to search ~/Dropbox. If I hit ALT+ENTER on any result to search with Spotlight, the scope is no longer ~/Dropbox, but the entire system.

Yes! Except, Alfred also uses whatever is highlighted in the search result instead of my original search term, i.e. if I activated the workflow using 'find helvetica', and I pressed Alt+Enter, instead of showing a finder spotlight search looking for 'Helvetica', it's looking for the highlighted results 'HelveticaNeueeTextPro-Bold', which is not what I want.

Edited by johnjoonso
Link to comment
  • 3 months later...
  • 2 weeks later...

Use this AppleScript in a Run Script action (Language /usr/bin/osascript): 

set theQuery to "{query}"

tell application "Finder"
	set thePath to (home as Unicode text) & "Fonts"
	set theDirectory to thePath as alias
	open theDirectory
	activate
	-- Change the delay to something long enough so that
	-- the Finder window is activated and receives the
	-- keystroke events
	delay 0.3
	tell application "System Events"
		tell process "Finder"
			set value of text field 1 of group 5 of toolbar 1 of front window to theQuery
			keystroke "f" using {command down}
		end tell
	end tell
end tell

You might have to alter the ...text field 1 of group 5 of toolbar 1... line if you've customised Finder's toolbar.

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