• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Safari reload script.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Safari reload script.


  • Subject: Safari reload script.
  • From: Jordan Rickards <email@hidden>
  • Date: Sun, 24 Oct 2004 12:08:46 -0700

Hi List,

I am new to applescript and trying to do the following. I work at an apple reseller and we use gsx a lot. GSX has a time out feature that gets really annoying. We want a way in the back ground for a apple script to reload the gsx page, if it is open. The script I have is as follows. I need some help doing the following. This scripts errors if there is no safari window open, and also if safari is not open. I would like the script to just ignore it self when there are no windows and also when Safari is not open. I thought the on error would do that but it does not seem so. It would also would be nice if message box would come up and ask you to reload just incase the user is in the middle of something. But if the user is not there it would select the option to reload after like 10 seconds or so. I hope I'm not asking to much. It would also be nice for the applescript to look at multiple tabs/windows and find the one with gsx in it but I'm not sure if that is possible. Thanks in advance for any help

Jordan

(* No Message Box*)
on idle
tell application "Safari"
try
set activeURl to URL of the front document
if activeURl contains "gsx.apple.com" then
do JavaScript "window.location.reload()" in front document
end if
on error
exit repeat
end try
return 10
end tell
end idle

on run
idle
end run

--->
(*Message Box*)
on
idle
tell application "Safari"
set activeURl to URL of the document 1
display dialog "GSX needs to reload so it won't timeout." buttons ¬
{"Cancel", "Reload GSX"} default button 1
if button returned of the result is "Reload GSX" and activeURl contains "gsx.apple.com" then
do JavaScript "window.location.reload()" in document 1
else if button returned of the result is "Cancel" then
exit repeat
end if
return 10
end tell
end idle

on run
idle
end run

Jordan Rickards
Technology Support
Washougal School District 112-6
Phone: 360-954-3273
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Safari reload script.
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Creating a chart or graphic line...
  • Next by Date: Re: Safari reload script.
  • Previous by thread: Re: Tell "Finder" to print with properties
  • Next by thread: Re: Safari reload script.
  • Index(es):
    • Date
    • Thread