New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

apple script to greet me off stand by


Post Reply New Thread Subscribe

 
Thread Tools
jakeroberts

 
Member Since: Apr 10, 2007
Posts: 313
jakeroberts will become famous soon enough

jakeroberts is offline
Hello, I have put together an applescript ( from pieces of other peoples scripts and a bit of my own. Upon boot the script tells me the date and time, says hello, checks my email and notifies me of new messages. It also opens my favorite programs. What I would like to write now is a similar script that will do most of this when the computer comes off standby. What I don't know/can't seem to find is how to begin the script. I assume it needs to be triggered by the same event that "wakes the computer up" but that could be wrong to. I guess what I need to know is how to trigger the script. Its probably obvious but I am very green at this so if I have asked a bad or unclear question please let me know. Also, I am posting the original script for anybody that wants it to use. Thanks --Jake

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))
delay 2
tell application "Terminal" to activate
tell application "Safari" to activate
tell application "Firefox" to activate
tell application "Finder"
if the (count of windows) is not 0 then
set collapsed of every window to true
end if
end tell

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
tell application "Finder"
if the (count of windows) is not 0 then
set collapsed of every window to true
end if
end tell



say "script successfully completed"
end tell
QUOTE Thanks

Post Reply New Thread Subscribe


« Cobol | Choosing a Language. »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Scared for my iBooks sake! X Im just meE o Apple Notebooks 27 12-19-2005 11:41 AM
Done Deal - Apple converts to x86 Intel falltime Apple Rumors and Reports 180 06-07-2005 07:20 PM
Apple Stock WilliS Schweb's Lounge 4 10-15-2004 01:13 AM

All times are GMT -4. The time now is 09:51 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?