yanges,
I use this script for my greeting after startup.
tell application "Sound Scripting"
set Cur_Vol to sound volume
set sound volume to 3
quit
end tell
tell application "Finder"
set weekday1 to the weekday of (the current date) as string
set day1 to the day of (the current date) as string
set month1 to the month of (the current date) as string
set the time_slug to my format_time_using(the current date, " ", {"H", "MM"})
if the time of (the current date) is greater than 4.31675E+4 and the time of (the current date) is less than 8.63675E+4 then
set the AMPM_index to "PM"
else
set the AMPM_index to "Ay M"
end if
if the time of (the current date) is greater than 0 and the time of (the current date) is less than 43200 then
set the greeting_phrase to "[[emph -]]Good Morning! "
else if the time of (the current date) is greater than or equal to 43200 and the time of (the current date) is less than 57600 then
set the greeting_phrase to "Good Afternoon! "
else
set the greeting_phrase to "[[emph -]]Good Evening! "
end if
say "[[rate 200]] " & greeting_phrase & "[[rate 240]]Its " & weekday1 & " the " & day1 & "th of " & month1 & ", " & time_slug & " " & AMPM_index without waiting until completion
set volume of Cur_Vol
end tell
tell application "Finder"
activate
end tell
on format_time_using(this_date_record, delimiter_string, format_list)
set the time_index to the time of this_date_record
set the hour_index to ((the time_index) / hours) div 1
set the minute_index to �
(((the time_index) / minutes) - (the hour_index * 60))
set the formatted_time to ""
-- count the number of items in the list
set the item_count to the count of the format_list
-- parse the format list
repeat with i from 1 to the item_count
set this_item to item i of the format_list
if the (hour_index > 12) then
set the hour_index to hour_index - 12
end if
if the (hour_index = 0) then
set the hour_index to 12
end if
set the minute_index to round_truncate(minute_index, 0)
if (the minute_index = 60) then
set the hour_index to hour_index + 1
if the (hour_index > 12) then
set the hour_index to hour_index - 12
end if
set the minute_index to ""
end if
if this_item is "H" then
set the formatted_time to �
the formatted_time & the hour_index as string
else if this_item is "MM" then
set the low_number to 1
set the high_number to 10
if the minute_index is greater than or equal to the low_number and �
the minute_index is less than the high_number then �
set minute_index to �
("O " & (the minute_index as string))
if the minute_index is 0 then
set minute_index to ""
end if
set the formatted_time to �
the formatted_time & minute_index as string
end if
if i is not the item_count then
-- add delimiter
set the formatted_time to �
the formatted_time & delimiter_string as string
end if
end repeat
return the formatted_time
end format_time_using
on round_truncate(minute_index, 0)
set minute_index to (minute_index + 0.5417) div 1
return minute_index
end round_truncate
Anyone care to optimize it for me? It works fine though.