dfay Posted April 24, 2013 Share Posted April 24, 2013 (edited) Updated March 26, 2022 to use Python 3 for MacOS 12.3 Now featuring Universal Action triggers and hotkeys for the following five actions: Uppercase Lowercase Capitalize - capitalizes all words (e.g. Posting A New Topic In Share Your Workflows) Title Case - capitalizes word except for "the", "in", "of" etc. according to American English title conventions (e.g. Posting a New Topic in Share Your Workflows) Sentence Case - capitalizes only the first letter of the first word & converts the rest to lower case All of these are set to Copy to Clipboard and Paste by default. There's also a script filter cc which lets you view the query converted and select your choice (like the Code Case workflow). You can also connect a hot key directly to the cc script filter directly to view the output options without typing the cc command and pasting your text. Download: https://www.dropbox.com/s/8fydkkef1t699et/Case Converter 3.alfredworkflow?dl=0 NB This is a new link and will download as a new workflow - you'll need to migrate any hotkeys and delete or disable the older version. Here's the old Python 2 version in case anyone wants it: https://www.dropbox.com/s/3k2lh21g5wnqrkp/Case Converter 2.alfredworkflow?dl=0 The original version is described below and still available, if anyone prefers it. Workflow Version: This workflow converts the case of the text on the clipboard. http://dfay.fastmail.fm/alfred/Case%20Converter.alfredworkflow There are two workflows which display the following five options: Uppercase Lowercase Capitalize - capitalizes all words (e.g. Posting A New Topic In Share Your Workflows) Title Case - capitalizes word except for "the", "in", "of" etc. according to American English title conventions (e.g. Posting a New Topic in Share Your Workflows) Sentence Case - capitalizes only the first letter of the first word & converts the rest to lower case The keyword case will transform the text on the clipboard without pasting the result. The keyword casep will transform the text on the clipboard and paste (using Applescript System Events) Hotkey Version: Here is a version for use with hotkeys which will operate on the active selection in OS X and paste it with the converted text. These all have a half second delay prior to pasting, which is necessary for Applescript to be able to paste. http://dfay.fastmail.fm/alfred/Case%20Hotkeys.alfredworkflow Notes and Revision History: These use the Title Case perl script found at https://raw.github.com/ap/titlecase/master/titlecase . If you manage academic citations with BibDesk, Zotero, Papers, Mendeley, etc., Title Case conversion is especially useful for cleaning up downloaded citations. Updated May 3, 2013 with nicer colored icon thanks to mjv ( http://www.alfredforum.com/user/4384-mjv/ ) Updated February 5, 2014 to handle Sentence Case and to add a second keyword to paste after conversion. Updated May 20, 2014 with hotkeys Edited April 19, 2022 by dfay update re python 3 poirpom, gandalfsaxe, Viver de Dividendos and 15 others 12 6 Link to comment
nickvitale Posted April 30, 2013 Share Posted April 30, 2013 This is awesome! I have searched high and low for an easy way to do this. Applescripts, Alfred workflows, clipboard tricks, macros, entire applications, dashboard tools, Apple services, workflows, ... I think I made my point. I just wanted something easy. This is it. You have, literally, solved a multi-year search for a simple way to convert text to different cases. Also.. I'm not a coder, programmer or anything else so even if I found that github installation, I'd fail to make it work. Thank you again! formulated 1 Link to comment
dfay Posted April 30, 2013 Author Share Posted April 30, 2013 Thanks! I was in the same situation - I had Services, BibDesk applescript, OnMyCommand commands, etc. but a lot of them were context-specific and in locations that didn't sync from one computer to another, so an Alfred workflow seemed like the perfect way to put it all in one place. Link to comment
yoose Posted May 1, 2013 Share Posted May 1, 2013 Thanks, this is really useful! Since you guys mentioned that you were looking for other methods, there is an app that has the similar functionality through an extension, Popclip http://pilotmoon.com/popclip/ It is pretty convenient as it is automatically appears, iOS style, if you use your keyboard to select text and do not want to use the mouse, you can easily create a hotkey to have alfred make the menu appear, which is what I have done. Link to comment
hzlzh Posted May 1, 2013 Share Posted May 1, 2013 Good one, share it on the list below. Link to comment
nickvitale Posted May 2, 2013 Share Posted May 2, 2013 Thanks, this is really useful! Since you guys mentioned that you were looking for other methods, there is an app that has the similar functionality through an extension, Popclip http://pilotmoon.com/popclip/ It is pretty convenient as it is automatically appears, iOS style, if you use your keyboard to select text and do not want to use the mouse, you can easily create a hotkey to have alfred make the menu appear, which is what I have done. In fact I have this app. I like it. At home on my Retina it's no problem to have running 24/7 but at work I have to count every, single, megabyte of RAM used and I have to use it carefully. Also, Popclip costs something, something that should cost nothing considering the 'power' a Mac has, even in Applescript, it's astounding that there isn't one really good service or script for something like this. Running an entire app, though filled with other features, is a bit crazy for this single feature. However, I take your point. It's definitely a valid solution, especially for either casual users or people that have enough RAM to validate the use of. I have used it, at home, and it has a lot of great plugins that offer a big increase in functionality like the Evernote integration. Thanks Link to comment
yoose Posted May 3, 2013 Share Posted May 3, 2013 In fact I have this app. I like it. At home on my Retina it's no problem to have running 24/7 but at work I have to count every, single, megabyte of RAM used and I have to use it carefully. Also, Popclip costs something, something that should cost nothing considering the 'power' a Mac has, even in Applescript, it's astounding that there isn't one really good service or script for something like this. Running an entire app, though filled with other features, is a bit crazy for this single feature. However, I take your point. It's definitely a valid solution, especially for either casual users or people that have enough RAM to validate the use of. I have used it, at home, and it has a lot of great plugins that offer a big increase in functionality like the Evernote integration. Thanks I agree it is a great little program and has great plugins, cant wait to see what else comes up. I also feel like it should be in OS X seeing as how its inspired by iOS, but am grateful that it is not too expensive. Link to comment
kithairon Posted May 22, 2013 Share Posted May 22, 2013 Very sweet. Thanks for this! Use it with my bibliography tool. dfay 1 Link to comment
Davide Posted July 1, 2013 Share Posted July 1, 2013 Thanks for this also! Is it possible to get it work also with special charakters like the Germans ä, ö, ü, ß? Link to comment
dfay Posted July 1, 2013 Author Share Posted July 1, 2013 I've looked quickly at some options using Perl and Python (as well as bash tr , the existing approach) & none of them have worked for me....I'm not an expert in either though. http://ubuntuforums.org/showthread.php?t=1054470 http://bioinfo2.ugr.es/documentation/Perl_Cookbook/ch01_10.htm Both of these work for unaccented characters, but not for accented. If you can find a script that works, hooking it into the workflow should be trivial. Link to comment
iNyar Posted October 17, 2013 Share Posted October 17, 2013 Hi, Great workflow, really ! It's great to have this. Thanks a lot. Only a small suggestion: I'd like a 5th option : Sentence Case : only the first letter of the sentence would be capitalized (useful especially for French titles, which only use a capital on the first word). Link to comment
MxmHrpr Posted January 22, 2014 Share Posted January 22, 2014 Hi, Great workflow, really ! It's great to have this. Thanks a lot. Only a small suggestion: I'd like a 5th option : Sentence Case : only the first letter of the sentence would be capitalized (useful especially for French titles, which only use a capital on the first word). +1 on this addition, especially useful when my lecturer has his powerpoints in solid caps... Link to comment
juanpazos Posted January 23, 2014 Share Posted January 23, 2014 How do I make the text, after converted, be automatically pasted on where the cursor is (without the need of pressing Cmd+V)? Thanks Link to comment
juanpazos Posted January 23, 2014 Share Posted January 23, 2014 One more thing: accentuated caracters (like "á", "ó", "ã" , "ç") don't get converted at all. The bastards stay the same. Is there a fix for that? Link to comment
dfay Posted February 8, 2014 Author Share Posted February 8, 2014 Updated February 5, 2014 to handle Sentence Case and to add a second keyword to paste after conversion. On accented characters, see my post of 7/1/2013. Cheers Derick Link to comment
Davide Posted February 11, 2014 Share Posted February 11, 2014 (edited) Devon offers an plugin called WordService, it works also with special characters. Edited February 11, 2014 by Davide Link to comment
dfay Posted May 21, 2014 Author Share Posted May 21, 2014 Updated to add a version set up for use with hotkeys. thec13 1 Link to comment
deanishe Posted June 6, 2014 Share Posted June 6, 2014 I've looked quickly at some options using Perl and Python (as well as bash tr , the existing approach) & none of them have worked for me....I'm not an expert in either though. http://ubuntuforums.org/showthread.php?t=1054470 http://bioinfo2.ugr.es/documentation/Perl_Cookbook/ch01_10.htm Both of these work for unaccented characters, but not for accented. If you can find a script that works, hooking it into the workflow should be trivial. Python works perfectly, but only with Unicode, not encoded strings: print('UTF-8 strings\n') for s in ['über außer', 'öffnungszeiten für morgen']: print(s.title()) print(s.upper()) print('\nUnicode\n') for s in [u'über außer', u'öffnungszeiten für morgen']: print(s.title()) print(s.upper()) outputs: UTF-8 strings üBer AußEr üBER AUßER öFfnungszeiten FüR Morgen öFFNUNGSZEITEN FüR MORGEN Unicode Über Außer ÜBER AUßER Öffnungszeiten Für Morgen ÖFFNUNGSZEITEN FÜR MORGEN Link to comment
PhilosopherDog Posted August 26, 2014 Share Posted August 26, 2014 (edited) Hi, do you have a link to the May version? I only see the latest link to the Feb version. BTW, nice workflow! Thanx. Edited August 26, 2014 by PhilosopherDog Link to comment
patrickmcd Posted August 27, 2014 Share Posted August 27, 2014 Awesome. But I'm here to beg for more. All the options here would be nice: titlecase.com Camel, Pascal, Hyphen, and Snake would be great additions for coders, camelCase being the reason I searched for a workflow. Link to comment
dfay Posted August 28, 2014 Author Share Posted August 28, 2014 Hi, do you have a link to the May version? I only see the latest link to the Feb version. BTW, nice workflow! Thanx. It's there - it's the second link in the post - I've updated the initial post to make it clearer that there are two different download links. Link to comment
dfay Posted August 28, 2014 Author Share Posted August 28, 2014 @patrickmcd I'll do this in a separate workflow Link to comment
mixterdee Posted September 2, 2014 Share Posted September 2, 2014 Great little workflow and very useful for me, something I will use many times a day. Thanks 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