For the dock issue, I assume you've tried setting the 'Hide' option in the Startup Items preference? If so, and it still pops, I don't know... I don't use any startup items (mostly because I never shutdown or log out
As for the script, it works for me. It's not the optimal way to run the script, though, for example, you run "get the time of (the current date) twice, meaning the system has to run current date twice, and extract the time element both times. You can optimize the script by using a variable like:
Code:
tell application "Finder"
set theTime to time of (current date)
if (theTime >= 0) and (theTime < 21600) then
say "It's late, sleep."
end if
end tell
I'm also not sure you need to check that theTime is greater than zero... I can't think of any situation where the time would be negative, meaning you don't need to bother checking it at all.