Jump to content

Case Converter (including Title Case) - now working on MacOS 12.3


Recommended Posts

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

 

ccdemo.thumb.png.613a61bc39aced79368717b23792f127.png

 

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 by dfay
update re python 3
Posted

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!

Posted

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.

Posted

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.

Posted

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

Posted

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.

  • 3 weeks later...
  • 1 month later...
Posted

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.

  • 3 months later...
Posted

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

  • 3 months later...
Posted

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

  • 3 weeks later...
Posted

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

  • 3 months later...
  • 3 weeks later...
Posted

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

  • 1 month later...
  • 5 weeks later...
Posted

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.

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
×
×
  • Create New...