Go Back   MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 2, 2013, 04:50 AM   #1
mrsir2009
macrumors 604
 
mrsir2009's Avatar
 
Join Date: Sep 2009
Location: Melbourne, Australia
Applescript to reload a Safari page

Would anyone happen to know what the applescript script would be to reload a page on Safari at intervals - Say, reload it every 10 minutes, for example?

Thanks!
mrsir2009 is offline   0 Reply With Quote
Old Feb 2, 2013, 05:10 AM   #2
justperry
macrumors 603
 
justperry's Avatar
 
Join Date: Aug 2007
Location: 7 Km South of an active upside down (boat) volcano.
Quote:
Originally Posted by mrsir2009 View Post
Would anyone happen to know what the applescript script would be to reload a page on Safari at intervals - Say, reload it every 10 minutes, for example?

Thanks! :)
Does the next thing work for you?

Save this as a bookmark, name it reload or so, the if you want to reload a page click this bookmark(in Bookmark Bar) and it will ask you the time to reload.

javascript:(function(p){open('','',p).document.write('%3Cbody%20id=1%3E%3Cnobr%20id=2%3E%3C/nobr%3E%3Chr%3E%3Cnobr%20id=3%3E%3C/nobr%3E%3Chr%3E%3Ca%20href=%22#%22onclick=%22return!(c=t)%22%3EForce%3C/a%3E%3Cscript%3Efunction%20i(n){return%20d.getElementById(n)}function%20z(){c+=0.2;if(c%3E=t){c=0;e. location=u;r++}x()}function%20x(){s=t-Math.floor(c);m=Math.floor(s/60);s-=m*60;i(1).style.backgroundColor=(r==0||c/t%3E2/3?%22fcc%22:c/t%3C1/3?%22cfc%22:%22ffc%22);i(2).innerHTML=%22Reloads:%20%22+r;i(3).innerHTML=%22Time:%20%22+m+%22:%22+(s %3C10?%220%22+s:s)}c=r=0;d=document;e=opener.top;u=prompt(%22URL%22,e.location.href);t=u?prompt(%22S econds%22,60):0;setInterval(%22z()%22,200);if(!t){window.close()}%3C/script%3E%3C/body%3E')})('status=0,scrollbars=0,width=100,height=115,left=1,top=1')

Last edited by justperry; Feb 2, 2013 at 07:36 AM. Reason: Disabled smilies in text.
justperry is offline   0 Reply With Quote
Old Feb 2, 2013, 05:20 AM   #3
mrsir2009
Thread Starter
macrumors 604
 
mrsir2009's Avatar
 
Join Date: Sep 2009
Location: Melbourne, Australia
Quote:
Originally Posted by justperry View Post
Does the next thing work for you?

Save this as a bookmark, name it reload or so, the if you want to reload a page click this bookmark(in Bookmark Bar) and it will ask you the time to reload.

javascriptfunction(p){open('','',p).document.write('%3Cbody%20id=1%3E%3Cnobr%20id=2%3E%3C/nobr%3E%3Chr%3E%3Cnobr%20id=3%3E%3C/nobr%3E%3Chr%3E%3Ca%20href=%22#%22onclick=%22return!(c=t)%22%3EForce%3C/a%3E%3Cscript%3Efunction%20i(n){return%20d.getElementById(n)}function%20z(){c+=0.2;if(c%3E=t){c=0;e. location=u;r++}x()}function%20x(){s=t-Math.floor(c);m=Math.floor(s/60);s-=m*60;i(1).style.backgroundColor=(r==0||c/t%3E2/3?%22fcc%22:c/t%3C1/3?%22cfc%22:%22ffc%22);i(2).innerHTML=%22Reloads:%20%22+r;i(3).innerHTML=%22Time:%20%22+m+%22:%22+(s %3C10?%220%22+s:s)}c=r=0;d=document;e=opener.top;u=prompt(%22URL%22,e.location.href);t=u?prompt(%22S econds%22,60):0;setInterval(%22z()%22,200);if(!t){window.close()}%3C/script%3E%3C/body%3E')})('status=0,scrollbars=0,width=100,height=115,left=1,top=1')

Edit: You see a smiley in the link, just quote me and you see the normal code, it's MR's BB code doing this not me.
Man, that's fantastic Thanks a ton!
mrsir2009 is offline   0 Reply With Quote
Old Feb 2, 2013, 05:31 AM   #4
justperry
macrumors 603
 
justperry's Avatar
 
Join Date: Aug 2007
Location: 7 Km South of an active upside down (boat) volcano.
Quote:
Originally Posted by mrsir2009 View Post
Man, that's fantastic Thanks a ton!
This code seems to mess with MR's page formatting (this thread).

The only problem with this is you get another tab and it needs to be open afaik, I just tested to drag the Tab off so it opens in another window but then it does not work anymore, probably lost connection with the other tab, might be sandboxed.

Cheers Perry
justperry is offline   0 Reply With Quote
Old Feb 2, 2013, 01:47 PM   #5
mrsir2009
Thread Starter
macrumors 604
 
mrsir2009's Avatar
 
Join Date: Sep 2009
Location: Melbourne, Australia
Quote:
Originally Posted by justperry View Post
This code seems to mess with MR's page formatting (this thread).

The only problem with this is you get another tab and it needs to be open afaik, I just tested to drag the Tab off so it opens in another window but then it does not work anymore, probably lost connection with the other tab, might be sandboxed.

Cheers Perry
Funny... Because it works fine with me without opening any other tabs.
mrsir2009 is offline   0 Reply With Quote
Old Feb 2, 2013, 09:42 PM   #6
justperry
macrumors 603
 
justperry's Avatar
 
Join Date: Aug 2007
Location: 7 Km South of an active upside down (boat) volcano.
Quote:
Originally Posted by mrsir2009 View Post
Funny... Because it works fine with me without opening any other tabs.
I am on 10.5.8 with safari 5.0.6, that might be the difference.
justperry is offline   0 Reply With Quote
Old Feb 2, 2013, 09:55 PM   #7
mrsir2009
Thread Starter
macrumors 604
 
mrsir2009's Avatar
 
Join Date: Sep 2009
Location: Melbourne, Australia
Quote:
Originally Posted by justperry View Post
I am on 10.5.8 with safari 5.0.6, that might be the difference.
Haha, probably... Iím on ML with the latest version of Safari. Thanks again for the script, btw!
mrsir2009 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad: [Safari] Why do websites reload when I switch tabs? ntegra iOS 7 35 May 12, 2014 12:18 PM
Reload this Page Fanspeed/CPU Temp Benchmarks help Nick Jinks MacBook Pro 2 Mar 12, 2014 09:07 AM
General: Swipe gesture to "reload" a web page in Safari? bobright Jailbreaks and iOS Hacks 3 Jun 1, 2013 10:00 AM
Please help: Pages reload when swiping back in Safari raw8725 OS X 10.8 Mountain Lion 14 Feb 28, 2013 09:49 PM
Why does Safari always reload when I go back/forward? boomboom2 OS X 10.8 Mountain Lion 20 Aug 23, 2012 10:43 AM

Forum Jump

All times are GMT -5. The time now is 05:28 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps