I have the following script that we use to make monthly folders and subfolders for filing. I would like to expand the script to create folders and subfolders for an entire year. My delma is I think it can be done faster, but I just don’t know how to make that happen. The process of creating the subfolders seems to be what makes it lag. And I am afraid by doing an entire years worth at once it could really bog down.
property theMonths : {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}
property theWeekdays : {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}
set destinationFolder to choose folder with prompt "Choose destination folder"
tell (current date) to set thisMonth to (it - (its day) * days + days - (its time))
set monthList to {}
repeat with i from 0 to 23
tell (thisMonth + i * 32 * days) to set end of monthList to ((its month as integer) as string) & " / " & its year
end repeat
set chosenMonth to (choose from list monthList with prompt "choose a month") as string
if chosenMonth is "false" then return
tell thisMonth to set {its month, year} to words of chosenMonth
tell thisMonth to tell it + 32 * days to set lastDate to day of (it - (its day) * days + 86399)
set m to item (1st word of chosenMonth as integer) of theMonths
repeat with oneDay from 0 to lastDate - 1
tell (thisMonth + oneDay * days) to set {wk, dy} to {its weekday as integer, its day}
if wk > 2 then
set folderName to text -2 thru -1 of ("0" & dy) & space & m & space & item wk of theWeekdays
try
tell application "Finder" to set dateFolder to make new folder at destinationFolder with properties {name:folderName}
tell application "Finder" to set SubDestination to make new folder at dateFolder with properties {name:"ADS"}
tell application "Finder" to make new folder at SubDestination with properties {name:"LIVE"}
tell application "Finder" to make new folder at SubDestination with properties {name:"FINISHED"}
tell application "Finder" to set SubDestination to make new folder at dateFolder with properties {name:"PAGES"}
tell application "Finder" to make new folder at SubDestination with properties {name:"LIVE"}
tell application "Finder" to make new folder at SubDestination with properties {name:"FINISHED"}
tell application "Finder" to set SubDestination to make new folder at dateFolder with properties {name:"PHOTOS"}
tell application "Finder" to set SubDestination to make new folder at dateFolder with properties {name:"PLAN"}
tell application "Finder" to make new folder at SubDestination with properties {name:"LAYOUT PLAN"}
tell application "Finder" to make new folder at SubDestination with properties {name:"PRESS ORDERS"}
tell application "Finder" to make new folder at SubDestination with properties {name:"REPORTS"}
end try
end if
end repeat
display dialog "The script is finished running." buttons {"OK"} default button 1
Model: iMac
Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)