Safari reload script.
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