• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: All Caps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: All Caps


  • Subject: Re: All Caps
  • From: Nick Hearn <email@hidden>
  • Date: Mon, 8 Oct 2007 10:20:11 +0100

***Before acting on this email or opening any attachment you are advised to read the disclaimer at the end of this email***
************************************

David,

Here's some code from Apple.
Have a look at the handler change_case_of.

Regards,

Nick


(*
Change Case of Item Names

Copyright © 2001 Apple Computer, Inc.

You may incorporate this Apple sample code into your program(s) without
restriction.  This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours.  You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes.  If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)

try
tell application "Finder" to set the source_folder to (folder of the front window) as alias
on error -- no open folder windows
set the source_folder to path to desktop folder as alias
end try
display dialog "Change case to:" buttons {"Cancel", "UPPER", "lower"}
set the button_pressed to the button returned of the result
set the item_list to list folder source_folder without invisibles
set source_folder to source_folder as string
repeat with i from 1 to number of items in the item_list
set this_item to item i of the item_list
set this_item to (source_folder & this_item) as alias
set this_info to info for this_item
set the current_name to the name of this_info
tell application "Finder"
if the button_pressed is "lower" then
set the name of this_item to my change_case_of(the current_name, "lower")
else
set the name of this_item to my change_case_of(the current_name, "upper")
end if
end tell
end repeat
beep 2

on change_case_of(this_text, this_case)
if this_case is "lower" then
set the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set the source_string to "abcdefghijklmnopqrstuvwxyz"
else
set the comparison_string to "abcdefghijklmnopqrstuvwxyz"
set the source_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end if
set the new_text to ""
repeat with thisChar in this_text
set x to the offset of thisChar in the comparison_string
if x is not 0 then
set the new_text to (the new_text & character x of the source_string) as string
else
set the new_text to (the new_text & thisChar) as string
end if
end repeat
return the new_text
end change_case_of






On 8 Oct 2007, at 10:04, David Bradley wrote:

Hi,

Been have a search on google but no luck.

Just wondering what the syntax is in applescript for making text 'all caps'

Cheers

David Bradley
Senior Web Programmer
Globe Media
Brookfields Way
Manvers
Wath-upon-Dearne
Rotherham
S63 5DL

Tel: 01709 768231
Fax: 01709 768011
email@hidden
www.globe-media.com





**********************************************************************
Communisis plc - registered no: 2916113 is a limited company registered in England and Wales and whose registered office is at Wakefield Road, Leeds, LS10 1DU.

Please Note: This e mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy (s) of the Communisis group in general.

Confidentiality: This e-mail and the contents of any attachments are intended for the named recipient(s) only and may be confidential. If you have received this e-mail and its contents in error you must take no action based on them, nor must you copy or show them to anyone. Please reply to this e-mail and highlight the error.

Warning: Although this e-mail and any attachments have been scanned for viruses, Communisis cannot guarantee that they are virus free. The Communisis group therefore accepts no responsibility for any loss or damage caused by transmission of this e-mail.
**********************************************************************

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

References: 
 >All Caps (From: David Bradley <email@hidden>)

  • Prev by Date: All Caps
  • Next by Date: Re: All Caps
  • Previous by thread: All Caps
  • Next by thread: Re: All Caps
  • Index(es):
    • Date
    • Thread