dfay

Case Converter (including Title Case)

39 posts in this topic

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 by dfay
vanderholm, nikivi, _mk_ and 6 others like this

Share this post


Link to post

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!

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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 :D

Share this post


Link to post

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 :D

 

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.

Share this post


Link to post

Thanks for this also!

Is it possible to get it work also with special charakters like the Germans ä, ö, ü, ß?

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

One more thing: accentuated caracters (like "á", "ó", "ã" , "ç") don't get converted at all. The bastards stay the same.

 

Is there a fix for that?

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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 by PhilosopherDog

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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