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 > Mac OS X > Simple AppleScript Program

Simple AppleScript Program
Thread Tools
Forum Regular
Join Date: Nov 2000
Status: Offline
Reply With Quote
Nov 10, 2003, 04:27 PM
 
Hi All,

I want to create a simple AppleScript program that will open Internet Explorer every hour and go to a particular website.

I don't know how to do this... I've searched the Apple site and have came up short.

Does anyone know how I could learn how to do this?

This may not be the correct forum for this... sorry if that is the case.

Thanks for your time.
     
Forum Regular
Join Date: Nov 2000
Status: Offline
Reply With Quote
Nov 10, 2003, 04:30 PM
 
I forgot to mention that I'm running 10.3
     
Posting Junkie
Join Date: Nov 2001
Location: Retired.
Status: Offline
Reply With Quote
Nov 10, 2003, 04:32 PM
 
Wouldn't this involve some sort of daemon constantly running in the background?
     
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Nov 10, 2003, 05:02 PM
 
Originally posted by gorickey:
Wouldn't this involve some sort of daemon constantly running in the background?
Yes, and since we all already have such a daemon running, we should make use of it. This daemon is cron.

There are two ways. You can open the browser window, like you're wanting to do, or if you just want the page to load and don't care about seeing it, you can use curl from the command line. I use curl to update my dynamic DNS IP once every half hour.

First, you will need CronniX. It's a simple GUI editor for cron and it's free.

General Step: You will need to do this no matter which way you want it to work. In CronniX, hit the "New" button. Set the minute to 0, and click the "any" box for hour, day of month, month, and day of week. The command depends on which way you want it.

To have it open a web page, set the command to:
osascript -e 'open location "http://www.macnn.com"' > /dev/null

To have it just load the URL (for dynamic IP updating or counter increase, for example), use the command:
curl "http://www.macnn.com" > /dev/null

Change "http://www.macnn.com" to whatever URL you want to open. Make sure you click the "Save" button in CronniX when you're done editing.

Hope this helps.
( Last edited by Xeo; Nov 10, 2003 at 05:08 PM. )
     
Sal
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status: Offline
Reply With Quote
Nov 10, 2003, 07:46 PM
 
Originally posted by dvwannabe:
Hi All,

I want to create a simple AppleScript program that will open Internet Explorer every hour and go to a particular website.

I don't know how to do this... I've searched the Apple site and have came up short.

Does anyone know how I could learn how to do this?

This may not be the correct forum for this... sorry if that is the case.

Thanks for your time.
Here you go. Save this script as an application with the Stay Open option checked.

It assumes that Internet Explorer is your default browser.

Code:
on idle ignoring application responses open location "http://www.apple.com" end ignoring return 3600 end idle
     
Sal
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status: Offline
Reply With Quote
Nov 10, 2003, 09:10 PM
 
Just an FYI, with iCal 1.5.1 you can now run AppleScripts scripts as the action for timed events!

For complete details, go here:

http://www.apple.com/applescript/ical/
     
   
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 02:12 AM.
All contents of these forums © 1995-2014 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2014, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2