applescript syntax help

Apr 10, 2007
Reaction score
Hello, I am working on a script for myself and I am stuck on a couple of things.
I have it greet me and announce the time on boot but I want it to exclude the seconds from the time when it says it aloud.

The second problem is that I have it start my favorite apps on boot, which works fine but I want them to start minimized. I am posting the entire script, thanks in advance.

--say time commands
-- need to exclude seconds
set theDate to current date
set theDay to weekday of theDate
set theTime to time of theDate

if the theTime > 0 and the theTime < 43200 then say ¬
"Good morning Jake! It's " & theDay & "."
if the theTime > 43199 and the theTime < 57600 then say ¬
"Good afternoon Jake!"
if the theTime > 57599 and the theTime < 64800 then say ¬
"Good evening Jake!"
if the theTime > 64799 and the theTime < 86400 then say ¬
"It's " & theDay & " night."
say "the time is"
say (time string of (current date))

tell application "Mail"
check for new mail

set unreadCount to unread count of inbox

if unreadCount is equal to 0 then say ¬
"You have no new messages!"
if unreadCount is equal to 1 then say ¬
"You have a new message!"
if unreadCount is greater than 1 then say ¬
"You have " & unreadCount & " new messages!"
delay 2

-- app open commands

tell application "Terminal" to activate
--tell application "Terminal" to close window 0 I tried this line but it returns errors.

tell application "Safari" to activate
--tell application "Safari" to close window 0

tell application "Firefox" to activate
--tell application "Firefox" to close window 0

--check mail commands

-- lets me know it finished without errors
say "script end"
end tell
Mar 11, 2004
Reaction score
If the answers depend on more than a few experienced scripters who might come across your post here, try a specialty site, such as, and its forums.

There doesn't appear to be a search function other than for entire sections of the site, but you can use Google to search for more specific subjects. F'rinstance:

"check mail"
time speak
"close window"

Shop Amazon

Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.