Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Prints the months in order, starting with the current month
  2. #
  3. # By Kyle Brodie
  4. set d to month of (current date) as integer
  5. set str to ""
  6. set str to str & numToDate(d)
  7. repeat with index from 1 to (12 - d)
  8.     set str to str & " " & numToDate((d + index))
  9. end repeat
  10. repeat with index from 1 to (d - 1)
  11.     set str to str & " " & numToDate(index)
  12. end repeat
  13. return str
  14.  
  15. on numToDate(num)
  16.     if num = 0 then
  17.         return "ERROR"
  18.     else if num = 1 then
  19.         return "Jan"
  20.     else if num = 2 then
  21.         return "Feb"
  22.     else if num = 3 then
  23.         return "Mar"
  24.     else if num = 4 then
  25.         return "Apr"
  26.     else if num = 5 then
  27.         return "May"
  28.     else if num = 6 then
  29.         return "June"
  30.     else if num = 7 then
  31.         return "July"
  32.     else if num = 8 then
  33.         return "Aug"
  34.     else if num = 9 then
  35.         return "Sept"
  36.     else if num = 10 then
  37.         return "Oct"
  38.     else if num = 11 then
  39.         return "Nov"
  40.     else if num = 12 then
  41.         return "Dec"
  42.     end if
  43. end numToDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement