Re: Changing CAPITAL to Upper And Lower Case
Re: Changing CAPITAL to Upper And Lower Case
- Subject: Re: Changing CAPITAL to Upper And Lower Case
- From: CYB <email@hidden>
- Date: Sun, 14 Jan 2007 21:18:36 -0600
- Thread-topic: Changing CAPITAL to Upper And Lower Case
Title: Re: Changing CAPITAL to Upper And Lower Case
I sometimes use this little trick, maybe you found it useful
set NombreFolder to "CARLoS YsuNZA"
set NombreFolder to do shell script "python -c \"import sys; print unicode(sys.argv[1], 'utf8').upper().encode('utf8')\" " & quoted form of NombreFolder
-->>"CARLOS YSUNZA"
set NombreFolder to do shell script "python -c \"import sys; print unicode(sys.argv[1], 'utf8').lower().encode('utf8')\" " & quoted form of NombreFolder
-->>"carlos ysunza"
set NombreFolder to do shell script "python -c \"import sys; print unicode(sys.argv[1], 'utf8').title().encode('utf8')\" " & quoted form of NombreFolder
-->>"Carlos Ysunza"
Carlos Ysunza B.
Director
Ysunza/Santiago
Comunicación Visual • Automatización
Tel. (52)55 5256-0336
email@hidden
http://www.ysunzasantiago.com
http://www.thesecretmexico.com
http://www.softrobot.com.mx
> From: Christopher Nebel <email@hidden>
> Date: Fri, 12 Jan 2007 15:41:49 -0800
> To: AppleScript Users <email@hidden>
> Subject: Re: Changing CAPITAL to Upper And Lower Case
>
> On Jan 12, 2007, at 1:30 PM, Andrew Oliver wrote:
>
>> On Jan 12, 2007, at 12:50 PM, Ripka, Herb wrote:
>>
>>> We have a book where the titles are all CAPITAL letters (and in
>>> style sheet "One").
>>>
>>> Is there a way in AppleScript where the titles (in style sheet
>>> "One") can be changed to Upper And Lower Case instead?
>>
>> Care to share the application your book is written in?
>>
>> Since AppleScript drives the application the solution is going to
>> vary greatly depending on the app in question.
>
> That is, the process of getting and setting the titles is going to
> vary greatly. For instance, are the titles easily fetchable
> properties, or do you have to analyze the text to figure out where
> they are? The process of turning a string into title case (yes,
> that's the technical term) the text is probably going to be
> independent of the application, however, unless your application
> happens to have a command to do it.
>
> While AppleScript can ignore or consider case when comparing text, it
> doesn't have any built-in mechanism for changing case. If you're
> willing to use AppleScript Studio, then you can use Cocoa's
> "capitalizedString" method; otherwise you're going to need to do it
> yourself. This isn't particularly hard if you're willing to limit
> yourself to the 26 unaccented Roman letters.
>
> Bear in mind that strict title case -- capitalizing every word -- may
> not be what you want. Editorial guidelines on this sort of thing
> differ.
>
>
> --Chris Nebel
> AppleScript Engineering
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden