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.

applescript syntax help


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 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
QUOTE Thanks
Brown Study

 
Brown Study's Avatar
 
Member Since: Mar 11, 2004
Location: Winnipeg
Posts: 1,964
Brown Study is a name known to allBrown Study is a name known to allBrown Study is a name known to allBrown Study is a name known to allBrown Study is a name known to allBrown Study is a name known to allBrown Study is a name known to all
Mac Specs: G4 Tiger and OS 9

Brown Study is offline
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 site:macscripter.net
time speak site:macscripter.net
"close window" site:macscripter.net
minimize site:macscripter.net
QUOTE Thanks

Post Reply New Thread Subscribe


« Game Development | Simple Programming »
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
Applescript Help! Nick8539 OS X - Development and Darwin 0 09-01-2006 03:31 PM
Simple AppleScript request... 570thusaag Running Windows (or anything else) on your Mac 0 02-02-2006 12:33 PM
Terminal and Applescript bigpixl OS X - Development and Darwin 0 08-09-2005 12:34 PM
[ANN] New comprehensive AppleScript book hanaan OS X - Development and Darwin 0 11-06-2004 07:28 PM
Looking for AppleScript help tommyabroad OS X - Operating System 2 04-14-2004 12:51 AM

All times are GMT -4. The time now is 02:18 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?