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 > Enthusiast Zone > Classic Macs and Mac OS > AppleScript help needed!

AppleScript help needed!
Thread Tools
Mac Enthusiast
Join Date: May 2001
Location: United Knicker-dom
Status: Offline
Reply With Quote
Dec 27, 2001, 08:22 AM
 
I only know one thing about AppleScript: I can use it to automate processes. I don't know how to write inthe language...or anything, but I'd like to use it in OS X to automate a couple of processes.

I'd like to be able to have Mail and IE (in OS X) open at 6.00 am in the morning. I know that IE will automatically go to my homepage, but I also want it to open up a second window and go ot www.bbc.co.uk. Mail will automatically fetch my mail, so that is no big problem.

So, what I'm asking, is if one of you guys could write this script for me, or at least help me do it...

The script must...

1. Wake my Mac from sleep at 6.00am
2. Open up Mail.
3. Open IE with two windows...on to my homepage, and the second window going to www.bbc.co.uk

Thanks for any help in advance.

Play it cool

widget.alnora.com

for macintosh gui
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Jan 5, 2002, 10:32 PM
 
Check out the AppleScript section of this page for links to AppleScript resources: Things Macintosh

Also, from the Finder, choose "Help Center" from the "Help" menu, then select "AppleScript Help".

[ 01-05-2002: Message edited by: Rainy Day ]
     
Mac Enthusiast
Join Date: May 2001
Location: United Knicker-dom
Status: Offline
Reply With Quote
Jan 6, 2002, 06:29 PM
 
Originally posted by Rainy Day:
<STRONG>Check out the AppleScript section of this page for links to AppleScript resources: Things Macintosh

Also, from the Finder, choose "Help Center" from the "Help" menu, then select "AppleScript Help".

[ 01-05-2002: Message edited by: Rainy Day ]</STRONG>
Thats original./.don't think I haven't already done that?

Play it cool

widget.alnora.com

for macintosh gui
     
Junior Member
Join Date: Dec 1999
Location: USA
Status: Offline
Reply With Quote
Jan 7, 2002, 12:42 AM
 
I'm not running &nbsp; &nbsp; but maybe this app will help.

Good luck!

<font color = blue>Tom</font>

<font color = blue>Description:</font>
CronniX is a Aqua frontend to the powerful Unix tool "cron". Cron is a Unix system service that allows scheduled execution of scripts, programs, applications - in short anything that can be started from the command line. This includes OSX applications and AppleScripts.

&nbsp; &nbsp; &nbsp; <font color = green>* License: Freeware
&nbsp; &nbsp; &nbsp; * Author/Publisher: Koch und Schmidt Systemtechnik
&nbsp; &nbsp; &nbsp; * Release Date: September 9, 2001
&nbsp; &nbsp; &nbsp; * Requirements: Mac OS X</font>
     
Forum Regular
Join Date: Feb 2001
Status: Offline
Reply With Quote
Jan 7, 2002, 01:53 AM
 
Here's part of your script:

repeat until time of (current date) is 21600--21600=21600 seconds after midnight=0600 hours

end repeat
tell app "Mail"--this block completes requirement 2
run
end tell

tell app "Internet Explorer"--this block completes requirement 3
OpenURL "http://www.bbc.co.uk" toWindow 0
end tell

You can't wake your computer from sleep via AppleScript. Even if the script is running when the computer is put to sleep, the script's execution will be halted.

(120)

[ 01-08-2002: Message edited by: AppleScript ]
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Jan 7, 2002, 11:36 AM
 
Originally posted by georgius:
<STRONG>
So, what I'm asking, is if one of you guys could write this script for me, or at least help me do it...

The script must...

1. Wake my Mac from sleep at 6.00am
2. Open up Mail.
3. Open IE with two windows...on to my homepage, and the second window going to www.bbc.co.uk
</STRONG>
First, your AppleScript cannot wake the machine since the script won't be running at the time you want to wake. Prior to Mac OS X, the Energy Saver control panel had options for waking the system at preset times. I don't see the same option under Mac OS X - anyone?

If you can't put the system to sleep then you can either do as AppleScript suggests, which is run the script continuously, checking the time and doing nothing until 6am, or you can use cron, Script Scheduler, or other time-based tool.

The problem with the first approach is that you'll constantly be using CPU cycles checking the time when 99.99% of the time you don't care.

A better approach is to write the script to do just the actions you want (Open Mail, IE, etc.) and separately control the execution.

To use cron (built into Mac OS X), open a command window and type:
<font face = "courier">
crontab -e</font>

this will edit your crontab (which is probably empty right now).

Then add the line:

0 6 * * * /path/to/your/script

This tells your system to execute /path/to/your/script at 6:00 every day (as long as the machine is turned on).

<font face = "courier">man cron</font> and <font face = "courier">man crontab</font> will give you more info on running cron, including how to schedule weekday-only execution (unless you get up at 6am on weekends, too).
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 -4. The time now is 05:15 PM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2