raguay.customct Posted July 11, 2013 Share Posted July 11, 2013 (edited) Description: Just created a quick and easy TextSoap Cleaners workflow to allow for the execution of any of the TextSoap cleaners on the current clipboard contents. It is using the applescript interface to the TextSoap Menu application. Therefore the full application does not need to be running. It works faster than the PopClip extension for TextSoap. This will also remember past used cleaners and give them back to you as an option. That way you can build your most used list here as well. It can also pop up a list of all cleaners in Alfred for you to pick from. Download: https://github.com/raguay/MyAlfred/blob/master/Alfred 5/TextSoap Cleaners 9.alfredworkflow Readme: This workflow is for using the TextSoap cleaners on text. Each keyword is described below: To Use: The "tc:clean" keyword to select from a list of cleaners or a previously used cleaner. The particular TextSoap cleaner will be performed on the contents of the clipboard. If you hold down the FN key, it will delete that cleaner from the list of most used cleaners. You can use a hot-key to launch the last cleaner automatically on the current selection and copy the results back in place. It also has a hot key to copy the current selection, show a list of available cleaners, perform the cleaner, and copy the results back. The "tc:full" keyword will list every cleaner available and perform the selected cleaner on the clipboard contents. In order to have the list of every cleaner, you should run the keyword “tc:getcleaners" each time you add a new cleaner to Text Soap. You can set an editor to use to edit your personal cleaner list using the "tc:seteditor" keyword. You can then use the "tc:editlist" to edit your list of most used cleaners. You can get a line, word, character count of what is in the clipboard using “tc:count”. It will clean out formatting first (HTML to plain text). If you pass a string with the command, it will count that string. You can set a hotkey to count the selected text. The count is placed back into the clipboard. tc:loadpopclipext This will load the popclip extension for executing the last cleaner on the highlighted text. There are also three places to set your hotkeys: one for doing a character/word/line count of your selection, one for evoking the last cleaner on selected text, and one for choosing from the full list of cleaner to apply on the currently selected text. Current Version: 2.3 changed on 06/26/2014 I refactored and cleaned up a lot of code. Added the line, word, character counting as well. Just fixed problem with sorting cleaners by location in list and use. Now, Alfred sorts each cleaner by times used only. Current Version: 3.0 changed on 11/22/2022 The link above has been changed to the 3.0 version. Sorry for the inconvenience of not updating this sooner. Current Version: 6.0 Just updated to Alfred 5. This workflow no longer uses environment variables. It still uses node.js if the compiled version of the internal program isn't used. Let me know if you need more functionality or you find a bug. Richard Guay Edited November 22, 2022 by raguay.customct Version Update thec13 and GatorMapi 2 Link to comment
raguay.customct Posted July 18, 2013 Author Share Posted July 18, 2013 (edited) I just fixed the way previously selected cleaners are presented to be less confusing. Also, it does semi-fuzzy matching on cleaner names to narrow down the list. Let me know if you think of any other improvements! You can update with AlleyOOP workflow. Edited July 18, 2013 by raguay.customct Link to comment
raguay.customct Posted July 18, 2013 Author Share Posted July 18, 2013 Another quick fix for AlleyOOP functionality and forcing the default action to the bottom of the list. Link to comment
hzlzh Posted July 20, 2013 Share Posted July 20, 2013 Submit the workflow on the List below and make a good share~ Link to comment
raguay.customct Posted July 20, 2013 Author Share Posted July 20, 2013 Submit the workflow on the List below and make a good share~ I just added all of my latest ones. Everything should be listed there as well. Link to comment
raguay.customct Posted July 30, 2013 Author Share Posted July 30, 2013 I just added a quick addition to perform the last text cleaner done with "tclean" (after updating the workflow) on the currently selected text and paste it back in. I have done some testing with it, but not much. I mostly work in the clipboard, but this functionality was requested. Please check it out and let me know how it goes. Link to comment
raguay.customct Posted August 28, 2013 Author Share Posted August 28, 2013 Just added two new commands: "tclean:getcleaners" This is to store a list of cleaners that you have in your copy of TextSoap and save them to a file for use in the next command. "tclfull" Same as the "tclean", but allows searching through the full list of cleaners obtained in the "tclean:getcleaners" command. This was done on request from @apkawel. Let me know if you have a special need as well. Link to comment
raguay.customct Posted August 28, 2013 Author Share Posted August 28, 2013 Just added a hotkey (shift-cmd-L) that will copy the current selection, ask for a cleaner from the entire list of cleaners, apply to the selection, and paste it back in place. I have tested it some, but would like to get feedback on how this works. Thanks. Link to comment
raguay.customct Posted September 30, 2013 Author Share Posted September 30, 2013 Hi, I finally got the last few bugs out and now use the Alfred list for all cleaners instead of the TextSoap popup. This version has two new hotkeys and many new functions. I updated the first post with all of the commands. If there is a new feature you need, just let me know about it. Link to comment
raguay.customct Posted November 15, 2013 Author Share Posted November 15, 2013 Fixed some bugs with not saving last used cleaner and streamlined other areas. Should run faster. Link to comment
raguay.customct Posted April 2, 2014 Author Share Posted April 2, 2014 Just updated with a lot of code refactoring and added line, word, character counting to it as well. Check it out. The documentation is on my web site at http://customct.com/alfred-2-workflows Link to comment
raguay.customct Posted April 24, 2014 Author Share Posted April 24, 2014 Just fixed a problem with Alfred sorting cleaners by location in list and number of times used. Now, even if you add or remove cleaners from your list, it sorts by the number of times that cleaner is used. The ID is now based solely on the cleaner's name and not position in the list of cleaners. Link to comment
raguay.customct Posted May 17, 2014 Author Share Posted May 17, 2014 Just fixed a bug with the "tc:fulla" macro. It now saves favorite cleaners using an external trigger. It is now working correctly. Please download the update and let me know if you have any problems. Thanks! Link to comment
Carlos-Sz Posted May 18, 2014 Share Posted May 18, 2014 Every time I see this post I think about purchasing TextSoap… One of these days you will gonna win raguay… Link to comment
raguay.customct Posted May 18, 2014 Author Share Posted May 18, 2014 Well, if you do you will not be disappointed. I have not used Awk once since I purchased it. It is a great little utility (especially if you do a lot of text work). Link to comment
raguay.customct Posted May 18, 2014 Author Share Posted May 18, 2014 Here is an article of mine on how to use TextSoap on large text processing projects: http://computers.tutsplus.com/tutorials/how-to-effortlessly-create-markdown-with-textsoap--mac-55744 Carlos-Sz 1 Link to comment
raguay.customct Posted June 26, 2014 Author Share Posted June 26, 2014 Hi, I just made a lot of bug fixes on this workflow and added some external triggers and a PopClip extension that will make use of the external trigger to perform a cleaner on the selected text. One action making use of three programs! Automation at it's best. Link to comment
raguay.customct Posted February 16, 2015 Author Share Posted February 16, 2015 Hi, I just updated all of the Script Filters to a Haskell program for speed. You can download from the above sources. Let me know if this did speed you up or not. I am trying to figure out how much improvement a dedicated program will be over scripts. Haskell produces much smaller programs than golang. So, I have been switching to it. Link to comment
woodman Posted March 3, 2015 Share Posted March 3, 2015 I get an unexpected error (in the debugger) when attempting to run the tc:clean command [ERROR: alfred.workflow.input.scriptfilter] Code 1: textsoap: /Users/woody/Library/Application Support/Alfred 2/Workflow Data/com.customct.TextSoapCleaners/cleaners.txt: openFile: does not exist (No such file or directory) The cleaners.txt file was created by tc:getcleaners and IS at the path specified in the error. Any hints as to what's going wrong here? Link to comment
raguay.customct Posted March 4, 2015 Author Share Posted March 4, 2015 This error is only shown if that file doesn't exist, which is the case if you have just started using the workflow. First time to run a cleaner, use "tc:full" and select a cleaner. That routine creates the cleaners.txt file that stores all the cleaners you have made use of. Anyway, I fixed the file not found error. It will now work, but say it could not find any. You still need to use the tc:full to select all the cleaners. I made this separation to make the tc:clean run faster (My full has over 200 cleaners, but my short version only has 50 that I use all the time). The new version is on Packal and my GitHub accounts. Let me know if you have any other problems. Link to comment
raguay.customct Posted February 4, 2016 Author Share Posted February 4, 2016 I just updated the workflow to work with TextSoap 8. If you haven't upgraded to this version, you should. It runs much faster and lots of bug fixes. The workflow currently only works with version 8. If you haven't upgraded, then just use the older version. I haven't added any other features. cands 1 Link to comment
raguay.customct Posted March 17, 2016 Author Share Posted March 17, 2016 The latest release of TextSoap 8 fixes all of the bugs with this workflow. Please update to version 8.0.5. This fixes the issues with new cleaners not showing up in the "tc:getcleaners" command. Please let me know if you find any other problems. Link to comment
cands Posted May 16, 2016 Share Posted May 16, 2016 (edited) I'm using TextSoap 8 together with this workflow a lot. It is very powerful, thank you for creating it! I have just a minor comment: The function for counting lines, words and characters sometimes counts one line less than what I expect if there is no newline character ending the last line. The built-in function in TextSoap 8 "Word Count - Notification" then counts one more paragraph than the number of lines given by your workflow. Would it be appropriate to add +1 to the line counter variable? Edited May 16, 2016 by cands Link to comment
raguay.customct Posted May 17, 2016 Author Share Posted May 17, 2016 (edited) I'm using TextSoap 8 together with this workflow a lot. It is very powerful, thank you for creating it! I have just a minor comment: The function for counting lines, words and characters sometimes counts one line less than what I expect if there is no newline character ending the last line. The built-in function in TextSoap 8 "Word Count - Notification" then counts one more paragraph than the number of lines given by your workflow. Would it be appropriate to add +1 to the line counter variable? Thanks. I am glad you like the workflow. It is the workflow I use the most too! If you do not copy the last lines carriage return, then it doesn't count that line as a full line. I always copy past the last line to get the carriage return and the count always comes out fine. I'll look into adding a detector for the last line not having a carriage return and add one if needed. That would be a more robust solution. But, I've converted everything to Alfred 3 now. Since they do not want us updating everything until Alfred 3 is out completely, you will need to wait until Alfred 3 is fully released to get the full update. For now, just copy past the last CR and your count will be fine. The routine uses the wc command line program. It is a peculiarity with that program. I also noticed that I did not package the "Clean For Word Count" cleaner with the workflow. If you create a cleaner with that name, you can specify actions to clean unwanted items (ie: - / \ * and the like) from the text before counting it. That way, your character count will be accurate to actual words and not punctuations. The wc program doesn't always get it right . Edited May 17, 2016 by raguay.customct cands 1 Link to comment
apkawel Posted May 18, 2016 Share Posted May 18, 2016 In case anyone browses the forum to figure out why this workflow stopped working after upgrading to Alfred 3, just go through the workflow and update scripts as follows: [e.g., tell application] "Alfred 2" → "Alfred 3". @raguay.customct, this workflow is indeed the best. Thank you once again! It may be my imagination, but it seems that this workflow is even faster on Alfred 3. Fantastic! :-) 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