franzheidl Posted January 12, 2013 Posted January 12, 2013 (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 June 7, 2013 by franzheidl thec13 1
jdfwarrior Posted January 12, 2013 Posted January 12, 2013 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?
franzheidl Posted January 12, 2013 Author Posted January 12, 2013 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
franzheidl Posted January 15, 2013 Author Posted January 15, 2013 The external-Applescropt-not-running question has been answered by Andrew here. I have reworked Open With Chocolat as a workflow (as well as it's Open With Sublime Text 2 sibling) now and opensourced them here: https://github.com/franzheidl/alfred-workflows
franzheidl Posted January 15, 2013 Author Posted January 15, 2013 (edited) And if you're not comfortable with git, get them here: Open With Chocolat: http://cl.ly/PMzk Open with Sublime Text 2: http://cl.ly/PNE7 Edited June 2, 2013 by franzheidl
MrClaye Posted January 16, 2013 Posted January 16, 2013 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 !
franzheidl Posted March 25, 2013 Author Posted March 25, 2013 Updated that one also according to a pull request by dbingham to my Open With Sublime Text 2 Workflow. Use the updated download links above or pull from github: https://github.com/franzheidl/alfred-workflows
franzheidl Posted June 2, 2013 Author Posted June 2, 2013 Updated the workflow to use "choc" as keyword (equivalent to Chocolat's CL tool command).
franzheidl Posted June 7, 2013 Author Posted June 7, 2013 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.
shrop Posted December 4, 2013 Posted December 4, 2013 Thanks for the time on the Chocolat workflow. Very nice!
franzheidl Posted December 15, 2013 Author Posted December 15, 2013 Much appreciated, good to see someone liking Chocolat as much as I do
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now