Change case in numbers

I am generally happy with iwork and numbers, but this ridiculously stupid problem has me so frustrated, I'm having second thoughts.

First stupidity: in order to change case in apple programs, you need to download and install WordService. I've done this. (I know apple has it under format>font>capitalization, but this doesn't help if your text was typed in capitals and you need to make it lowercase.)

Alternatively, you can try a binding workaround, such as this to create a shortcut to automatically lowercase the letters. I've done this as well.

The problem is, in numbers you may not select text in more than one cell at a time (talk about stupidity!), which means that you can't use EITHER the WordServices OR the shortcut. Obviously, apple allows you to use their own capitalization method with multiple cells selected, but that doesn't work for this purpose, as above.

So here's what I have: someone sent me a spreadsheet in which many cells are capitalized. There is NO WAY for me to uncapitalize them unless I select and capitalize EACH CELL separately. This is the most ridiculously simple task to do on any other platform, in any other software, but in apple software it has to be standing on my head, and will take 50 times as long. What in the world???

iMac 2009, Mac OS X (10.5.7)

Posted on Jun 3, 2009 3:48 PM

Reply
7 replies

Jun 4, 2009 1:13 AM in response to Z_man

Here is a simple and clean soluce:

--[SCRIPT changeCase]

(*
Enregistrer le script en tant que Script, Application ou Progiciel : changeCase.xxx
déplacer l'application créée dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Merci à Scott Lindsey & Ed.Stockly du forum applescript-users@lists.apple.com
qui m'ont aidé à construire le code récupérant le bloc sélectionné.
Sélectionnez le bloc de cellules à triter
menu Scripts > Numbers > changeCase
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as Script, Application or Application Bundle: changeCase.xxx
Move the newly created application into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Thanks to Scott Lindsey & Ed.Stockly from applescript-users@lists.apple.com
which helped me to build the code grabbing the selected range.
Select a group of cells.
menu Scripts > Numbers > changeCase
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (Vallauris, FRANCE)
4 juin 2009
*)
property theApp : "Numbers"
--=====
on run
set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()

tell application "Numbers"
activate
tell document dName to tell sheet sName to tell table tName

repeat with y from rowNum1 to rowNum2
repeat with x from colNum1 to colNum2
set tt to value of cell y of column x
if tt is not 0 then
set tt to my changeCase(tt, "lower") (*
The second argument may be: "upper", "lower", "title", "capitalize"
*)
set value of cell y of column x to tt
end if
end repeat
end repeat
end tell -- table of sheet of document
end tell -- Application
end run
--=====
on changeCase(txt, mode)
set python_script to "import sys; print sys.argv[1].decode('utf8')." & mode & "().encode('utf8')"
return do shell script "/usr/bin/python -c " & quoted form of python_script & " " & quoted form of txt
end changeCase
--=====
on getSelParams()
local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()

if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if

set two_Names to my decoupe(r_Name, ":")
set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
if item 2 of two_Names = item 1 of two_Names then
set {row_Num2, col_Num2} to {row_Num1, col_Num1}
else
set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
end if
return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
end getSelParams
--=====
on decipher(n, d, s, t)
tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
end decipher
--=====
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum

tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
on parleAnglais()
local z
try
tell application theApp to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]


Yvan KOENIG (from FRANCE jeudi 4 juin 2009 10:13:37)

Jun 4, 2009 6:17 AM in response to Z_man

Z_man,

First I have to say that you have greatly exceeded my expectations for poster with less than 10 posts. I keep track of the number of occurrences of the words stupid, frustrating, ridiculous, annoying, obvious and anything in ALL CAPS. I find that the frequency of these words is inversely proportional to the number of posts listed in the poster's profile. You deserve special recognition for using them all, especially since you are pushing my 10-post cutoff where I normally see a mellowing.

We're handicapped a bit here because your link doesn't work and so we don't know anything about your "binding workaround." I wonder though, what would be inconvenient or difficult about having an auxiliary plain table in your document where you could paste copies of the cells you want to convert into Column A and let Numbers do a conversion using =LOWER(A), then Copy and Paste Values back to the original location. You could do large column ranges at a time. The formula would only be a little more complex if you wanted to produce Sentence Case, and I'm sure you could handle that.

I used to be a regular Excel user, but have forgotten much of what I knew. Could you refresh my memory on how you would do this conversion on that platform? I'd like to try it out.

Regards,

Jerry

Jun 4, 2009 10:08 AM in response to Jerrold Green1

Hello Jerrold

(1) BRAVO BRAVISSIMO for the first part of your message.
I didn't wrote about that fearing to be rude given my poor English.

(2) If I remember well, the LOWER() function doesn't change the contents of the cell but changes only the way it is displayed so, it has sidebar effects if we are using the cell's contents in calculations.
This is why I posted a script which really changes the content's.
It would be a bad soluce if the cell was containing formulas but here it was written that it was filled from imported datas.

The script changes the contents of the cells themselves so, no extraneous column or table is required.

Yvan KOENIG (from FRANCE jeudi 4 juin 2009 19:08:52)

Jun 4, 2009 12:46 PM in response to Jerrold Green1

Hello

Happily, I wrote:

(2) If I remember well, the LOWER() function doesn't change


My memory fooled me.
LOWER() and UPPER() really change the case
It's in the Pages _Format > Font_ menu that Upper doesn't change the real contents.

So my script is more useful if the user wish to apply the title format or wish to capitalize.

Yvan KOENIG (from FRANCE jeudi 4 juin 2009 21:46:51)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Change case in numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.