property averageYear : "2015"
set theList to ""
set cd to (current date)
repeat with x from 1 to 12
set cd to (current date) # This, if uncommented, makes correct list
set day of cd to 1 # ADDED
set theIntegerTallyMonth to x
set month of cd to theIntegerTallyMonth
set theNameInsert to ((my averageYear) & " " & (month of cd as integer) & " (" & (month of cd as text) & ") Averaged" as text)
set theList to theList & theNameInsert & return
end repeat
theList
and all will work well.
In your original code, as we are on may 31th
when you set the month to 2, the script return an unwanted month because there is no day 31 in February, April, June, September and November.
The edited version set the day of the date to 1 so everything works well.
I would use:
property averageYear : "2015"
set theList to ""
set cd to (current date)
set day of cd to 1
repeat with x from 1 to 12
set theIntegerTallyMonth to x
set month of cd to theIntegerTallyMonth
set theNameInsert to ((my averageYear) & " " & (month of cd as integer) & " (" & (month of cd as text) & ") Averaged" as text)
set theList to theList & theNameInsert & return
end repeat
theList
Yvan KOENIG (VALLAURIS, France) dimanche 31 mai 2015 10:10:44