Does Safari have Auto Refresh?

Discussion in 'Mac Apps and Mac App Store' started by Tim in Phoenix, May 17, 2011.

  1. Tim in Phoenix macrumors member

    Joined:
    Apr 9, 2010
    #1
    Guys

    I like to pull up charts on websites to follow certain investments; can I have Safari refresh the window every minute or two to keep the charts current?


    .
     
  2. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #2
    You could probably write an Applescript, but this is not an available option by default.
     
  3. preste101, Sep 9, 2013
    Last edited: Sep 9, 2013

    preste101 macrumors newbie

    Joined:
    Sep 9, 2013
    #4
    Auto Refresh with Safari and being able to continue using browser

    Hey guys, I just posted this in another thread, but might as well post here. I wish I stumbled upon these threads earlier haha. Well here is the script that i wrote that will hopefully help someone. If you need help reply here and I'll try my best to help you out!

    This is the link to the script from a Snippet host - Snipt.org:
    http://snipt.org/Aggif4/Default

    And here is the raw code if the snipt page is deleted:
    Code:
    property url_list : {"", "", "", "", ""}
    property _defaultTotalRefreshes : 0
    property _defaultTotalSeconds : 1
    
    set _numoftabs to (choose from list {"1", "2", "3", "4", "5"} with prompt "How many tabs will you have open for auto Refreshing?" default items "1" OK button name "This Many" cancel button name "Nevermind")
    
    --These two variables are very self explanatory
    set _total to the text returned of (display dialog "How many total refreshes?" default answer ¬
    	_defaultTotalRefreshes with title "Total")
    set _seconds to the text returned of (display dialog "How many seconds per refresh?" default answer ¬
    	_defaultTotalSeconds with title "Seconds")
    
    --Set the default seconds to the previously entered number so it will be remembered 
    --for the next time the user runs the script
    set _defaultTotalSeconds to _seconds
    set _defaultTotalRefreshes to _total
    
    if _numoftabs = false then --Determine if the user wants to quit
    	error "User canceled." number -128
    else
    	repeat with i from 1 to _numoftabs --Fill the list with urls
    		set item i of url_list to text returned of (display dialog "What website do you want to set for tab " & i & "?" default answer "http://" with title "Enter the WHOLE address (http:// too)")
    	end repeat
    	
    	tell application "Safari"
    		make new document
    		set winID to the id of window 1 --crucial for not crossing over to other window
    		repeat with j from 1 to _numoftabs --open that list in new tabs
    			set URL of tab j of window id winID to item j of url_list
    			if j is less than _numoftabs then --opens the amount of tabs specified
    				make new tab of window id winID
    			end if
    		end repeat
    		
    		-- HERE IS THE AUTO REFRESH PART
    		repeat with _count from 0 to _total
    			repeat with k from 1 to _numoftabs
    				set URL of tab k of window id winID to item k of url_list
    				delay _seconds
    			end repeat
    		end repeat
    	end tell
    	
    end if
     
  4. mizaco macrumors member

    Joined:
    Sep 4, 2013
  5. preste101 macrumors newbie

    Joined:
    Sep 9, 2013
    #6
    I agree. Whelp we always have applescript haha
     

Share This Page