• 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: Novice question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Novice question


  • Subject: Re: Novice question
  • From: Michelle Steiner <email@hidden>
  • Date: Mon, 5 Nov 2001 16:18:26 -0700

On 11/5/01 1:13 PM, Alatorre, Michael <email@hidden> wrote:

>Our naming convention for these
>folders is YYYY-MM (e.g., 2001-10). Is there a way in AppleScript to
>incremently create a new folder once a month when it's time to post the
>report? In other words, can I get it to read the last folder created then
>correctly create and name the new one (taking into account when the year
>rolls over)? Thank you in advance.

Why not use the date itself to create the folder?

Compile this script as an applet, and place it in the startup items
folder. This script assumes that you will be rebooting the computer
every day.

--Michelle

property flag : false
set today to the current date
if day of today is 1 and flag is false then
set thisyear to the year of today
set thismonth to text 1 through 3 of (the month of today as string)
set monthAbbr to "JanFebMarAprMayJunJulAugSepOctNovDec"
set monthNum to ((the offset of thismonth in monthAbbr) + 2) div 3
set the foldername to (thisyear & "-" & monthNum) as text
tell application "Finder"
make new folder at startup disk with properties {name:foldername}
end tell
set flag to true
else if day of today is greater than 1 then
set flag to false
end if

----------------------------------------------------------------------
| 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: Novice question
  • Next by Date: Re: Launching AppleScript from CommandLine
  • Previous by thread: Re: Novice question
  • Next by thread: Re: Novice question
  • Index(es):
    • Date
    • Thread