Address Book contacts names in capital letters ?

you can’t upload images here on MacScripter. You need some own webspace (like dropbox) or a service

Ok i did a dropbox account and i uploaded 2 images with what i tried.

Please let me know what you think.

Here are the links:

http://dl.dropbox.com/u/10402031/Address%20Book%20Script%20with%20error.jpg

http://dl.dropbox.com/u/10402031/Address%20Book%20Script%20with%20error%202.jpg

Thanks

Chris.

The first image is no error message, the displayed missing value is just the result of the last executed line.
In the second image the error message says that the on capitalize() handler is missing.

So in the first image option i have to wait to finish ? It doesnt stops ?

What do you suggest to do to fix it ? Because as i see it wtops and doesnt work after the missing value message…

Yes, it could take time if you have a hugh amount of contacts.
The script has stopped when the Stop button is greyed out

Yes when i get the missing value message the Stop button is grayed out…

Sorry but it doesnt seem to work for me.

Then the script has finished. You don’t get any message unless you wrote one.
Are the appropriate contacts capitalized now?

Stefan I think there is a misunderstanding here… What i want to do is to make all the letters of my contacts first and last name appear in capital letters and not only the first letter of each one.
I understood this because i just saw that all the www… contacts i have are made as Www… so your script is working just fine but is not made for the purpose i want.
I am sorry if i didnt explain it properly from the beggining.
Sorry for saying that nothing changed but i already have all of my contacts written with their first letters in capitals so i couldnt see a change.

Sorry for the whole trouble. Changing all the letters of the first and last name of all the address book contacts with a script is it possible ?

change the on capitalize() handler into


on capitalize(n)
	do shell script "echo " & quoted form of n & " | tr a-z A-Z'"
end capitalize

it will convert the whole name strings into uppercase letters

Thanks for your reply.

I did edited and i get 2 errors as shown in the following image.

Any ideas ?

http://dl.dropbox.com/u/10402031/error%20in%20address%20book%20script%20for%20complete%20string%20capitalization.jpg

remove the single quote (last but one character) in the shell script line

Ok i did this and now it runs without giving any errors.

Thing is that it didnt convert all the contacts but only the last name of one written with english letters.

Also my address book is with greek letters so i suppose that i have to edit your script replacing the english a - z and A- Z characters with grrek. Is this correct ?

I just realized that it only fixed one contacts last name written in english. I have around 30 contacts written in english letters.

Sorry, I assumed you’re using arabic letters.
You can customize the tr command this way


on capitalize(n)
	do shell script "echo " & quoted form of n & " | tr 'αβγδεζθικλκμνξοπρςστφφχψω' 'ΑΒΔΎΕΖΗΙΚΛΛΝΝΞΠΡΣΤΤΥΦΧΨΩ'"
end capitalize

the number of characters in both alphabets must be the same, you can add the diacritical characters if needed

PS: Edit I doubt this works properly because of the UTF16 characters of the greek alphabet.
Don’t try it!

Thank you.

It now seems to work but the characters are not shown properly. Have a look :

http://dl.dropbox.com/u/10402031/address%20book%20error%20in%20greek%20letters.tiff

PS: Dont worry i have a back-up of my complete address book. :slight_smile:

I hope you have a backup of your address book :wink:
We must find another way to convert the characters

Yes i have a back-up.
I did export an Address Book Archieve before doing any testings. Already restored. :cool:

Thank you very much for everything and if you find any way that it could work please let me know.

Chris.

I recommend to install the Scripting Addition SatImage OSAX.
On the site click on “Satimage osax 3.5.2 (build 360)”.
Install the package.

Then use this script


tell application "Address Book"
	script a
		property l : get people
	end script
	
	repeat with aPerson in a's l
		set {first name:fName, last name:lName} to aPerson
		if fName is not missing value then set first name of contents of aPerson to uppercase fName
		if lName is not missing value then set last name of contents of aPerson to uppercase lName
	end repeat
	save addressbook
end tell


You are amazing!!

It works.

Have a look : http://dl.dropbox.com/u/10402031/Address%20Book%20script%20it%20works!!.jpg

Thank you so much.

You’re welcome.

I had 5 years classical greek in school so I’m able to read greek letters :wink: