Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Applescript Greeting Script

Applescript Greeting Script
Thread Tools
Mac Elite
Join Date: Jul 2001
Location: Evansville, IN
Status: Offline
Reply With Quote
Oct 19, 2002, 10:42 PM
 
I've created a script to greet me when I login. I set it as a login item. It isn't the ideal set up IMO, though. Is there a way I can get it to run w/o popping up in the dock when I login?

Also, is this the proper way to do the code?


Code:
tell application "Finder" if get the time of (the current date) is greater than or equal to 0 then if get the time of (the current date) is less than 21600 then say "Its late. Sleep" end if end if end tell
When I run it, it says its a program error and then '-1312' above the Edit button.

Any help?
Justin Williams
Chicks Really Dig Me
AIM - iTikki [NEW AND IMPROVED!]
http://www.tikkirulz.com
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Oct 20, 2002, 12:21 AM
 
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.
Gods don't kill people - people with Gods kill people.
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -5. The time now is 06:14 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2