ctwise Posted January 22, 2014 Share Posted January 22, 2014 (edited) Funnel takes text and converts it to some other text by running it through a filter. The filter can be a shell script one-liner or a full script. Anything that takes standard input and outputs to standard out. At the moment, the following filters are implemented: - Base64 - decode - Base64 - encode - AES-256 - decrypt with passphrase 'X' - AES-256 - encrypt with passphrase 'X' - x509 - fingerprint - x509 - hash - x509 - certificate information - Change case - lowercase - Change case - uppercase - Change case - capitalize - Change case - title case - JSON - format - String - reverse - String - format US phone number - Lines - clear bullets - Lines - sorted unique lines - Lines - number lines - Lines - bulletize - Lines - top 10 unique lines - Lines - remove blanks - Lines - unique lines only - Lines - doublespace - Markdown - convert search links to normal links - Markdown - convert to HTML - URL - encode - HTML - encode - Sort IPv4 addresses The Funnel workflow is a variant of the preexisting Pipe workflow (http://www.alfredforum.com/topic/1187-filter-clipboard-through-your-favourite-one-liners). I wasn't happy with how the workflow presented options and I didn't want the options sorted by Alfred. I also wanted to bundle some heavier processing scripts, so I created my own version of the workflow from scratch. The workflow can operate on text on the clipboard, on a file whose filename is on the clipboard, on selected text (using a hotkey) or on a selected file (using a hotkey). No matter where the text comes from, it is piped through the selected filter. If the text came from the clipboard or a selection, it is pasted into the active application after being processed. If the text came from a file, the file contents are replaced with the processed text. So, for example, if you select a block of text and trigger the workflow with a hotkey, you can choose 'Lines - bulletize' and the selected text will be replaced with bulleted lines. If you select a JSON file in Finder (or Path Finder) and trigger the file hotkey, you can choose 'JSON - format' and the file contents will be replaced with formatted JSON. Update: As Vitor pointed out, I forgot the link :-) https://github.com/packal/repository/raw/master/com.tedwise.funnel/funnel.alfredworkflow Edited January 22, 2014 by ctwise 40-02, vdesabou, Beery and 1 other 3 1 Link to comment
vitor Posted January 22, 2014 Share Posted January 22, 2014 You forgot the download link. Found it in packal, though. Link to comment
CarlosNZ Posted March 15, 2014 Share Posted March 15, 2014 Hmm, nothing's happening. What am I doing wrong? Tried the Markdown-HTML filter and the bulletize filter. Using both selected text and clipboard text. On 10.9.2 Link to comment
ctwise Posted March 15, 2014 Author Share Posted March 15, 2014 I just tested the workflow and it's working fine here. The only thing I can think of is your cursor isn't somewhere that allows pasting. Link to comment
ctwise Posted March 15, 2014 Author Share Posted March 15, 2014 Hmm, nothing's happening. What am I doing wrong? Tried the Markdown-HTML filter and the bulletize filter. Using both selected text and clipboard text. On 10.9.2 If you're using the latest Alfred, can you turn on workflow debugging and see if you see any output? Link to comment
CarlosNZ Posted March 16, 2014 Share Posted March 16, 2014 Okay, it's working now. Not sure what was going on. Probably my fault somehow. Link to comment
paulw Posted March 18, 2014 Share Posted March 18, 2014 The "funnel" keyword script filter has the title "Funnel selected text through filter" but it seems to ignore selected text and use the clipboard contents instead. Link to comment
ctwise Posted March 18, 2014 Author Share Posted March 18, 2014 The "funnel" keyword script filter has the title "Funnel selected text through filter" but it seems to ignore selected text and use the clipboard contents instead. You are correct. The only way in Alfred to act on selected text is through a hotkey. Otherwise the Alfred input box becomes the text source. I'll update the workflow. paulw 1 Link to comment
paulw Posted March 22, 2014 Share Posted March 22, 2014 Knowing next to nothing about scripting, I managed to adapt the HTML encode one-liner into an HTML decode one-liner: "HTML - decode": "php -r \"echo html_entity_decode(file_get_contents('php://stdin'), ENT_COMPAT | ENT_HTML401, 'UTF-8');\"", Link to comment
ctwise Posted March 22, 2014 Author Share Posted March 22, 2014 Knowing next to nothing about scripting, I managed to adapt the HTML encode one-liner into an HTML decode one-liner: "HTML - decode": "php -r \"echo html_entity_decode(file_get_contents('php://stdin'), ENT_COMPAT | ENT_HTML401, 'UTF-8');\"", Awesome! I added it to the workflow. paulw 1 Link to comment
Tiny Clanger Posted June 30, 2014 Share Posted June 30, 2014 When I try it, it doesn't complete the filter names. Debug output is as follows: [ERROR: alfred.workflow.input.scriptfilter] Code 1: complete.rb:2:in `require': no such file to load -- json (LoadError) from complete.rb:2 I can't actually see complete.rb anywhere in the workflow screen, and I don't know where Alfred stores workflows, so I can't debug this further myself. This is on OS X 10.8.5, with Alfred 2.3 (264). Does anybody have any ideas what's going wrong? Am I missing a gem? Thanks Link to comment
biggusjimmus Posted August 26, 2014 Share Posted August 26, 2014 Nice idea. Found this when I was about to post a simpler version that only did JSON en/decoding! Back to the old drawing board. Link to comment
Beery Posted December 2, 2017 Share Posted December 2, 2017 Is there an easy way to see all the filters (after typing "funnel")? Link to comment
GuiB Posted December 2, 2017 Share Posted December 2, 2017 9 hours ago, Beery said: Is there an easy way to see all the filters (after typing "funnel")? Insert 2 spaces after "|" or change the Script Filter node for the "|" keyword to "Argument Optional" (I think the second option would be best if you still want to filter the results normally) Link to comment
evanfuchs Posted December 2, 2017 Share Posted December 2, 2017 Is there a way to eliminate the extra single line break when converting to lowercase, uppercase, and title case (doesn't happen with capitalize) and the extra two line breaks per bullet when using "clear bullets"? Link to comment
GuiB Posted December 2, 2017 Share Posted December 2, 2017 (edited) 39 minutes ago, evanfuchs said: Is there a way to eliminate the extra single line break when converting to lowercase, uppercase, and title case (doesn't happen with capitalize) and the extra two line breaks per bullet when using "clear bullets"? Not without touching the code, but here I made it works for you. However, note that this would get reverted if you update to a newer @ctwise update if he don't make the change to his workflow. In short, in "filters.json" change "perl -nle" to "perl -ne" for the "lowercase" and "uppercase" actions. Change line 79 (print $_, "\n";) in the file "titlecase.pl" to "print $_;" and line 37 ($line =~ s/^([ \t]*)(\d+\. |[\*\+\-] )?\s*(.*)/${1}${3}\n\n/;) in the file "bulletlist.pl" to "$line =~ s/^([ \t]*)(\d+\. |[\*\+\-] )?\s*(.*)/${1}${3}/;" Download: https://nofile.io/f/B3kpSz6Pxom/Funnel.alfredworkflow Edited December 2, 2017 by GuiB evanfuchs 1 Link to comment
evanfuchs Posted December 2, 2017 Share Posted December 2, 2017 Hey, thanks @GuiB for taking the time. I had looked at the filters.json and bulletlist.pl, but it was beyond me. Your revisions work great. FYI, the case modifications do strip existing line breaks as well, but I think the original workflow did that, too. Thank you! Link to comment
GuiB Posted December 2, 2017 Share Posted December 2, 2017 @evanfuchs, you're right, sorry Here is an update with a fix to to the Titlecase: https://nofile.io/f/uQ4rUGs1Ra3/Funnel.alfredworkflow Link to comment
GuiB Posted December 3, 2017 Share Posted December 3, 2017 @evanfuchs, sorry for the delay, I needed to go... but I've found that you were maybe talking about the Capitalize action which I didn't modify before. I've found that it did what you said (it strips existing line breaks), so I fixed it (now using a simple python "capitalize()" function) Here is the updated workflow: https://nofile.io/f/0j4Gjdxwoby/Funnel.alfredworkflow Best! Chris Messina 1 Link to comment
Chris Messina Posted November 12, 2020 Share Posted November 12, 2020 Where is the latest version of this workflow? Is it on Packal? The links from @GuiB are now 404s. Link to comment
GuiB Posted November 12, 2020 Share Posted November 12, 2020 6 hours ago, chris said: Where is the latest version of this workflow? Is it on Packal? The links from @GuiB are now 404s. Hi Chris, it's been a while since I touched this workflow, but I think this should be my last version: https://d.pr/f/iAt51A Hope this helps! Chris Messina 1 Link to comment
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