Can someone help me figure out why this script wont work?

I’m very new to this site. (this is my first post on here) I have searched for this and was not successful. Also I am new to applescript but I have had some linux scripting classes and most of it looks to be similar. I think that what I am trying to do is pretty self explanitory but for some reason when I hit run it doesn’t do anything. Here is the script.

this is one version that i tried.

on run

set morning to time string of (current date) is less than "12:00:00 pm"
set afternoon to time string of (current date) is equal to "12:00:00 pm - 17:00:00 pm"
set evening to time string of (current date) is greater than "17:00:00 pm"

if time string of (current date) is morning then
	say "good morning"
else if time string of (current date) is afternoon then
	say "good afternoon"
else if time string of (current date) is evening then
	say "good evening"
end if

end run

and this is the second version that i tried.

on run
if time string of (current date) is equal to “12:00:00 am - 11:59:59 am” then
say “good morning”
end if
if time string of (current date) is equal to “12:00:00 pm - 16:59:59 pm” then
say “good afternoon”
end if
if time string of (current date) is equal to “17:00:00 pm - 11:59:59 pm” then
say “good evening”
end if
end run

Hi,

time string returns a string of current time depending on the international date format settings,
not a range of time.
For your purpose it’s sufficient to check the hour


set currentHour to hours of (current date)
if currentHour < 12 then
	say "good morning"
else if currentHour ≥ 12 and currentHour < 17 then
	say "good afternoon"
else
	say "good evening"
end if

That did it. Thanks a bunch.:cool: