• 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: Renaming a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming a folder


  • Subject: Re: Renaming a folder
  • From: Matthew Smith <email@hidden>
  • Date: Tue, 09 Oct 2001 10:42:27 +1000

on 05/10/01 14:05, Craig Walsh at email@hidden wrote:

> I was just wondering if anyone knows how to rename a folder to
> the current date of the machine.
>
> I try (current date) and it simply returns cannot put that data into the
> expected type!!!

This code does not use any extra scripting addition. Change the return
statement to get the format you want. Wouldn't it be good if you could
coerce a month to a number, end then a string.

on shortDate(theDate)
set theYear to year of theDate as string
set theDay to day of theDate as string
set theMonthVar to month of theDate
if theMonthVar = January then
set theMonth to "01"
else if theMonthVar = February then
set theMonth to "02"
else if theMonthVar = March then
set theMonth to "03"
else if theMonthVar = April then
set theMonth to "04"
else if theMonthVar = May then
set theMonth to "05"
else if theMonthVar = June then
set theMonth to "06"
else if theMonthVar = July then
set theMonth to "07"
else if theMonthVar = August then
set theMonth to "08"
else if theMonthVar = September then
set theMonth to "09"
else if theMonthVar = October then
set theMonth to "10"
else if theMonthVar = November then
set theMonth to "11"
else
set theMonth to "12"
end if
return theYear & theMonth & theDay
end shortDate
--
Matthew Smith


  • Follow-Ups:
    • Re: Renaming a folder
      • From: AppleScript Greg <email@hidden>
References: 
 >Renaming a folder (From: Craig Walsh <email@hidden>)

  • Prev by Date: Re: Project Builder & AppleScript
  • Next by Date: Re: Renaming a folder
  • Previous by thread: Renaming a folder
  • Next by thread: Re: Renaming a folder
  • Index(es):
    • Date
    • Thread