I am new to scripting so please forgive me, I may be thinking ouside the scope of my abilities. I am looking to build a script that I can use on a monthly basis to create a set of folders for specific days withing the selected month. For example: I choose August from a dropdown list and I get a group of folders built and named as “01 AUG WED” & “02 AUG THU” ect. However I need the script to skip Sundays & Mondays. If this is not clear enough I would be happy to clarify more. Thanks!
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
Hi,
try this, you can choose always the next 12 month from current month
and you will prompted to specify the destination folder
property theMonths : {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}
property theWeekdays : {"SUN", "MON", "TUE", "WED", "THU", "FRE", "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 1 to 12
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 make new folder at destinationFolder with properties {name:folderName}
end try
end if
end repeat
Wow!
That was fast. Thank you. Now if i can just learn to do it myself!