Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Prints out the current day (Sun, Mon) first and then
  2. # the rest of the week. If you want to make it say
  3. # Sunday instead of Sun just change it in the function
  4. # on numToDate(num)
  5. #
  6. # By Kyle Brodie
  7. set d to weekday of (current date) as integer
  8. set str to ""
  9. set str to str & numToDate(d)
  10. repeat with index from 1 to (7 - d)
  11.     set str to str & " " & numToDate((d + index))
  12. end repeat
  13. repeat with index from 1 to (d - 1)
  14.     set str to str & " " & numToDate(index)
  15. end repeat
  16. return str
  17.  
  18. on numToDate(num)
  19.     if num = 0 then
  20.         return "ERROR"
  21.     else if num = 1 then
  22.         return "Sun"
  23.     else if num = 2 then
  24.         return "Mon"
  25.     else if num = 3 then
  26.         return "Tue"
  27.     else if num = 4 then
  28.         return "Wed"
  29.     else if num = 5 then
  30.         return "Thu"
  31.     else if num = 6 then
  32.         return "Fri"
  33.     else if num = 7 then
  34.         return "Sat"
  35.     end if
  36. end numToDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement