Thread: applescript syntax help
05-12-2007, 10:45 AM #1
applescript syntax help
- Member Since
- Apr 10, 2007
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!"
-- 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"
05-12-2007, 11:19 AM #2
- Member Since
- Mar 11, 2004
If the answers depend on more than a few experienced scripters who might come across your post here, try a specialty site, such as macscripter.net, 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" site:macscripter.net
time speak site:macscripter.net
"close window" site:macscripter.net
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By kimsi in forum OS X - Operating SystemReplies: 2Last Post: 12-12-2013, 09:32 AM
By mohibb in forum OS X - Operating SystemReplies: 3Last Post: 04-27-2012, 11:48 AM
By ghalsk in forum OS X - Operating SystemReplies: 0Last Post: 12-03-2009, 09:09 AM
By fooddestroyer in forum OS X - Operating SystemReplies: 0Last Post: 11-16-2007, 04:50 AM