applescript auto refresh for safari

Discussion in 'Mac Apps and Mac App Store' started by bizzit, Jan 16, 2010.

  1. bizzit macrumors newbie

    Jan 16, 2010
    ok so im very new to applescript but already a HUGE fan of the possibilities. i'm looking to write a script that will auto refresh a web page ive loaded on safari. if possible id like to be able to set it to a specific safari window so that i can continue you brows in a separate window. any suggestions
  2. BrownCoatMal macrumors newbie

    Jan 28, 2010
    I'm wondering about this too. I'd like to auto refresh a page

    Any answers?
  3. preste101, Sep 9, 2013
    Last edited: Sep 9, 2013

    preste101 macrumors newbie

    Sep 9, 2013
    Auto Refresh, yet continue to use Browser

    I wish I stumbled upon this thread earlier. I've just written this script up for you guys. If anyone needs help using it just reply here and I'll try my best to help you out!

    This is the link to the script from a Snippet host -

    And here is the raw code if the snipt page is deleted:
    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
    	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
    		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. drewsof07 macrumors 68000


    Oct 30, 2006
    Here's a java script that does the same thing, just save to your bookmarks:


Share This Page