• 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: change case script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: change case script


  • Subject: Re: change case script
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 2 Nov 2001 06:23:19 -0700

On 11/2/01 5:47 AM, jake williamson 28 <email@hidden>
wrote:

>is it possible to compile a script that takes all the file names in a folder
>and coverts them to lower case and replaces a space with an underscore??

Here is a brute force method.

--Michelle

tell application "Finder"
set the teststring to the name of file 1 of folder "dora:foo:"
end tell
set the testlist to the text items of the teststring
repeat with letter in testlist
set asc to the ASCII number of the letter
if (asc is greater than 64) and (asc is less than 91) then
set the contents of the letter to ASCII character (asc + 32)
else if asc is 32 then
set the contents of the letter to "_"
end if
end repeat
set the teststring to the testlist as text
tell application "Finder"
set the name of file 1 of folder "dora:foo" to the teststring
end tell

----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------


  • Prev by Date: Re: a few questions
  • Next by Date: folder action: add - set modification date
  • Previous by thread: change case script
  • Next by thread: Re: change case script
  • Index(es):
    • Date
    • Thread