Jump to content

Open As Project in Chocolat workflow and a couple of questions


Recommended Posts

Posted (edited)

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
Posted

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?

Posted

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

Posted

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 !

  • 2 months later...
  • 2 months later...
Posted

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.

  • 5 months later...
  • 2 weeks later...

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