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 > AppleScript for Safari (Post Below Broken)

AppleScript for Safari (Post Below Broken)
Thread Tools
Mac Enthusiast
Join Date: Feb 2000
Location: Old Dominion University, Norfok, VA
Status: Offline
Reply With Quote
Feb 5, 2003, 02:57 PM
 
Hello all, I'm on a university network and I usually have things downloading while I'm in classes or at work. The network logs users off when there is no Internet access detected through a Web browser. Since Safari saves login IDs and passes in the Keychain, I was wondering if someone could give me the steps to make an AppleScript that would tell Safari to open a Web page every 30 minutes. Any and all help is greatfully appreciated! Thanks!
iPond317 | ODU Apple Campus Rep
"Ten years ago down by the lake I sunk my sweet love down to her watery grave." - Hello Again | DMB

Old: Apple IIc, PowerMac 7200/90, iMac Bondi Blue 233, Titanium PowerBook G4 400 - New: MacBook 2.0, iPhone 8GB, AirPort Extreme Gb, iPod 30GB 5th Gen
     
Dedicated MacNNer
Join Date: Nov 2002
Location: Rouge River
Status: Offline
Reply With Quote
Feb 5, 2003, 07:20 PM
 
Originally posted by iPond317:
Hello all, I'm on a university network and I usually have things downloading while I'm in classes or at work. The network logs users off when there is no Internet access detected through a Web browser. Since Safari saves login IDs and passes in the Keychain, I was wondering if someone could give me the steps to make an AppleScript that would tell Safari to open a Web page every 30 minutes. Any and all help is greatfully appreciated! Thanks!

Well, you need to do something like:

Code:
repeat every 10 minutes tell application "Safari" close every window make new document at beginning of documents set URL of document 1 to item i of URLs end tell end repeat
You can alter this with a list of URLs, and then have Safari open up a random URL every 10 minutes so that some automatic script won't detect that you're using a keep alive function.

BTW, I'm not absolutely sure that will function. I'm new to OS X, and by no means an applescript guru.
     
Sal
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status: Offline
Reply With Quote
Feb 6, 2003, 08:43 AM
 
To have a script wait, you need to use an Idle handler.

Save this script as an application with the "Stay Open" option checked in the Save Dialog. It will send the command to open the page every 10 minutes (10 * 60 seconds = 600 seconds).

Code:
on idle tell application "Safari" if not (exists document 1) then make new document at the beginning of documents end if set the URL of document 1 to "http://www.apple.com" end tell return 600 end idle

If Safari is setup as your default browser in the Internet System Pane, you can use this approach:

Code:
on idle open location "http://www.apple.com" return 600 end idle
     
   
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 12:34 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