How to run a script from Alfred or Spotlight or any run dialog?
Dterm

You might want to take a look at Dterm. This is a dialog under commandshiftreturn and does exactly what you are looking for and it does even more than that. 

As it says on the site:

"DTerm provides a context-sensitive command line that makes it fast and easy to run commands on the files you're working with and then use the results of those commands."