Jump to content

Create a Localhost at Folder (Multiple Arguments)

Recommended Posts

Hey there Alfred Community,


Full disclaimer: I am a hopeless newbie when it comes to the topics I'm addressing here, so I apologize in advance for ambiguous vocabulary.



Basically, I am trying to use a combination of "File Filter" and "Run Script" to open a server on a specific folder (for development's sake). 


In Terminal, I would do the following:


cd ~/PathToRelevantFolder

php -S localhost: (Port)


How do I transform this into a workflow such that I can use a file filter to return my folder of interest and provide an additional argument that allows me to specify the port I wish to use for the local host (e.g. 8000, 9090, 3012...). It's the latter half (providing the port argument) that's giving me the most difficulty.


My thanks in advance for any help anyone can give me!


Share this post

Link to post

Bonus: It'd be really nice if I could also add the additional step of opening a url in my default browser directing me to the localhost!


Can I combine, "File Filter", "Run Script" and "Open URL"?

Share this post

Link to post

@CocoCoding Welcome to the forum! Could you please fill in your Powerpack email address in your forum profile before asking for workflow-related help? Your details are only visible to admins (Andrew and myself) and it helps us confirm your Powerpack status. :)




Share this post

Link to post

@deanishe Bravo! This is awesome, and almost everything seems to be working. There seems to be a bit of an issue though with the file filter, though, as the terminal returns "No Such File or Directory" for a folder that is clearly there.


It looks to be an issue with how the directory path is specified, but to my naive eyes, I'm not at all sure.


This screen capture shows the difference between the results of the Alfred query file filter and the ever-reliable drag & drop path specification in Terminal:



Edited by CocoCoding

Share this post

Link to post

I think I figured out the issue: Unchecking all the modes of "escaping" on the terminal scripting node seemed to resolve the problem of directory.


Thanks again @deanishe for the excellent answer!

Share this post

Link to post
11 hours ago, CocoCoding said:

Unchecking all the modes of "escaping"


You should probably only uncheck "brackets". I checked that one, as I wasn't sure what kind of brackets it referred to. If you uncheck them all, it's definitely not correct.

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.

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