Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Section A.13. Chapter 13

A.13. Chapter 13

A.13.1. Exercise 1 solution

This answer uses the say command with the Bells voice. An iTunes solution is not shown here, but it is something you may want to try on your own to get authentic sounding chimes.

-- Big Ben!

set theTime to time string of (current date)
set theHour to first word of theTime as integer
set theMinutes to second word of theTime as integer

set theHour to 3
set theMinutes to 45

-- Get the hour

if theHour is 0 then
    set theHour to 12
else if theHour is greater than 12 then
    set theHour to theHour - 12
end if

set theChime to theMinutes div 15
if theChime is 0 then set theChime to 4


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint