Jump to content

Open As Project in Chocolat workflow and a couple of questions

Recommended Posts

Just reworked a simple Alfred v1 extension of mine to a workflow for Alfred 2:


Open the current Finder folder as a project in Chocolat by keyword ("choc") or as a folder/file action:


Download: http://cl.ly/PUTT


GitHub: https://github.com/franzheidl/alfred-workflows




It's truly great to be able to configure the two input methods (either by keyword or as an action) drag'n'drop-like!

I was doing a bit of gymnastics in my v1 extension to do just that (check if the query is a valid POSIX path passed by Alfred, or default, etc.) and now it's so easy to set up!


I tried to run an external Applescript file (located in the workflow directory) from within the workflow, but that didn't seem to work the way it worked for me with v1. Is that due to the non-finished Applescript implementation or by design? I'd love to have the option to do that, esp for more complex scripts instead of having the whole script in the Run Applescript Module of my workflow.


Also, since my old Applescript is working, am I correct in assuming Alfred 2 also passes the POSIX path of the folder/file  an action was called upon as the only parameter?


Anyway, no quirks or glitches so far, and v2 feels darn fast…


Edit: Updated the link, removed the non-working external script :)

Edited by franzheidl

Share this post

Link to post

On topic of the Applescript not working, did you remember to wrap the code in:


on alfred_script(q)


end alfred_script


can you confirm that you did wrap your code in that?

Share this post

Link to post

Yes of course, here's the full code that called an external .scpt file and worked fine in v1 :)




on alfred_script(q)

set theScript to my runScript("owc_main.scpt", q)

end alfred_script


on runScript(fileName, aQuery)

tell application "Finder"

set myScript to load script ((do shell script "pwd") & "/" & fileName)

set runMyScript to myScript's main(aQuery)

end tell

end runScript

Share this post

Link to post

GREAT ! Thank you very much ! I'm a total newbie in scripting and this is great for me to get how it works. I'll use and edit them for my own workflows for sure !

Share this post

Link to post

Updated Workflow to also open files or folders in Chocolat if user entered a path beginning with '~/'.

Use the updated download link above or pull from github.

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